1) Data Processing

NOTE: This includes all the set-up and processing for the CLSA Comprehensive cohort data

1.1) Set-up

if (!require("pacman")) install.packages("pacman")
## Loading required package: pacman
pacman::p_load(MASS,plyr,ggplot2,lme4,nlme, rms,dplyr, lubridate, effects,
               lmerTest,rpart,tableone,psych,Hmisc,
               lsmeans,openxlsx)
## Warning in readRDS(dest): lzma decoder corrupt data
## 
##   There is a binary version available but the source version is later:
##     binary source needs_compilation
## rms  6.7-0  6.7-1              TRUE
## installing the source package 'rms'
## Warning in utils::install.packages(package, ...): installation of package 'rms'
## had non-zero exit status
## 
## rms installed
## Warning in pacman::p_load(MASS, plyr, ggplot2, lme4, nlme, rms, dplyr, lubridate, : Failed to install/load:
## rms
set.seed(1)

setwd("~/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data")

1.2) Tracking Cohort

1.2.1) Baseline processing

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Baseline (Non-Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

setwd("~/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data/23SP001_McMaster_PRaina_BL")

trackBL<-read.csv("23SP001_McMaster_PRaina_Baseline_Trav4.csv")#Comprehensive Cohort Baseline

track.BL<-trackBL[c(1:5,104,926,798,106,892,921,32,1363,1377,1378,1379,1380,1407,1408,1433,1466,1432,1465,
                    1480,1481:1488,893,928,1093,1094,1096,1125,1124,376,1086,1089,1097:1102,1105,1106,
                    1129,1132,1133,1077,1076,1075,1078,1079,1085,1082,1130,1087,1090,1088,1131,1091,1080,
                    1128,1095,1081)]

#Sex
track.BL$Sex<-track.BL$SEX_ASK_TRM

#Age
track.BL$Age<-track.BL$AGE_NMBR_TRM

#Marital Status
track.BL$Relationship_status<-NA
track.BL$Relationship_status[track.BL$SDC_MRTL_TRM==1]<-"Single"
track.BL$Relationship_status[track.BL$SDC_MRTL_TRM==2]<-"Married"
track.BL$Relationship_status[track.BL$SDC_MRTL_TRM==3]<-"Widowed"
track.BL$Relationship_status[track.BL$SDC_MRTL_TRM==4]<-"Divorced"
track.BL$Relationship_status[track.BL$SDC_MRTL_TRM==5]<-"Separated"

#Education 4 Category
track.BL$Education4<-NA
track.BL$Education4[track.BL$ED_UDR04_TRM==1]<-"Less than High School Diploma"
track.BL$Education4[track.BL$ED_UDR04_TRM==2]<-"High School Diploma"
track.BL$Education4[track.BL$ED_UDR04_TRM==3]<-"Some College"
track.BL$Education4[track.BL$ED_UDR04_TRM==4]<-"College Degree or Higher"


#Household Income
track.BL$Income_Level<-NA
track.BL$Income_Level[track.BL$INC_PTOT_TRM==1]<-"<$20k"
track.BL$Income_Level[track.BL$INC_PTOT_TRM==2]<-"$20-50k"
track.BL$Income_Level[track.BL$INC_PTOT_TRM==3]<-"$50-100k"
track.BL$Income_Level[track.BL$INC_PTOT_TRM==4]<-"$100-150k"
track.BL$Income_Level[track.BL$INC_PTOT_TRM==5]<-">$150k"

#Living Status
track.BL$Living_status<-NA
track.BL$Living_status[track.BL$OWN_DWLG_TRM==1]<-"House"
track.BL$Living_status[track.BL$OWN_DWLG_TRM==2 |track.BL$OWN_DWLG_TRM==6]<-"Apartment/Condo/Townhome"
track.BL$Living_status[track.BL$OWN_DWLG_TRM==3]<-"Assisted Living"
track.BL$Living_status[track.BL$OWN_DWLG_TRM==4 | track.BL$OWN_DWLG_TRM==5 | track.BL$OWN_DWLG_TRM>=7]<-"Other"

#Alcohol      
track.BL$Alcohol<-NA
track.BL$Alcohol[track.BL$ALC_TTM_TRM==1]<-"Regular drinker (at least once a month)"
track.BL$Alcohol[track.BL$ALC_TTM_TRM==2]<-"Occasional drinker"
track.BL$Alcohol[track.BL$ALC_TTM_TRM==3]<-"Non-drinker"

#Smoking Status
track.BL$Smoking_Status<-NA
track.BL$Smoking_Status[track.BL$SMK_DSTY_TRM==1]<-"Daily Smoker"
track.BL$Smoking_Status[track.BL$SMK_DSTY_TRM==2 |track.BL$SMK_DSTY_TRM==3]<-"Occasional Smoker"
track.BL$Smoking_Status[track.BL$SMK_DSTY_TRM==4 | track.BL$SMK_DSTY_TRM==5]<-"Former Smoker"
track.BL$Smoking_Status[track.BL$SMK_DSTY_TRM==6]<-"Never Smoked"

track.BL$Ethnicity<-NA
track.BL$Ethnicity[track.BL$SDC_CULT_WH_TRM==1]<-"White"
track.BL$Ethnicity[track.BL$SDC_CULT_WH_TRM==0]<-"Other"

#############Physical Activity Scale for the Elderly######################
#Q1: Sitting Activity Frequency in Past 7 days
track.BL$PASE_Q1<-NA
track.BL$PASE_Q1[track.BL$PA2_SIT_MCQ==1]<-0
track.BL$PASE_Q1[track.BL$PA2_SIT_MCQ==2]<-0.11
track.BL$PASE_Q1[track.BL$PA2_SIT_MCQ==3]<-0.25
track.BL$PASE_Q1[track.BL$PA2_SIT_MCQ==4]<-0.43
track.BL$PASE_Q1[track.BL$PA2_SIT_MCQ>4]<-NA
track.BL$PASE_Q1[is.na(track.BL$PA2_SIT_MCQ)]<-NA

track.BL$PASE_Q1B<-NA
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ==1]<-0
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ==2]<-1
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ==3]<-3
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ==4]<-6
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ==5]<-10
track.BL$PASE_Q1B[track.BL$PA2_SITHR_MCQ>5]<- 0
track.BL$PASE_Q1B[is.na(track.BL$PA2_SITHR_MCQ)]<-NA
track.BL$PASE_Q1B<-as.numeric(track.BL$PASE_Q1B)

#Q2: Walking outside frequency
track.BL$PASE_Q2<- NULL
track.BL$PASE_Q2[track.BL$PA2_WALK_MCQ==1]<-0
track.BL$PASE_Q2[track.BL$PA2_WALK_MCQ==2]<-0.11
track.BL$PASE_Q2[track.BL$PA2_WALK_MCQ==3]<-0.25
track.BL$PASE_Q2[track.BL$PA2_WALK_MCQ==4]<-0.43
track.BL$PASE_Q2[track.BL$PA2_WALK_MCQ>4]<-NA
track.BL$PASE_Q2[is.na(track.BL$PA2_WALK_MCQ)]<-NA

track.BL$PASE_Q2A<- NA
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ==1]<-0
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ==2]<-1
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ==3]<-3
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ==4]<-6
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ==5]<-10
track.BL$PASE_Q2A[track.BL$PA2_WALKHR_MCQ>5]<-NA
track.BL$PASE_Q2A[is.na(track.BL$PA2_WALKHR_MCQ)]<-NA
track.BL$PASE_Q2A<-as.numeric(track.BL$PASE_Q2A)


#Q3: Light Sports or Activity Frequency
track.BL$PASE_Q3<- NA
track.BL$PASE_Q3[track.BL$PA2_LSPRT_MCQ==1]<-0
track.BL$PASE_Q3[track.BL$PA2_LSPRT_MCQ==2]<-0.11
track.BL$PASE_Q3[track.BL$PA2_LSPRT_MCQ==3]<-0.25
track.BL$PASE_Q3[track.BL$PA2_LSPRT_MCQ==4]<-0.43
track.BL$PASE_Q3[track.BL$PA2_LSPRT_MCQ>4]<-NA
track.BL$PASE_Q3[is.na(track.BL$PA2_LSPRT_MCQ)]<-NA

track.BL$PASE_Q3A<- NA
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ==1]<-0
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ==2]<-1
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ==3]<-3
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ==4]<-6
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ==5]<-10
track.BL$PASE_Q3A[track.BL$PA2_LSPRTHR_MCQ>5]<-NA
track.BL$PASE_Q3A[track.BL$PA2_LSPRT_MCQ == 1 | is.na(track.BL$PA2_LSPRTHR_MCQ)]<-0
track.BL$PASE_Q3A[is.na(track.BL$PA2_LSPRT_MCQ) & is.na(track.BL$PA2_LSPRTHR_MCQ)]<-NA
track.BL$PASE_Q3A[track.BL$PA2_LSPRT_MCQ>4 & is.na(track.BL$PA2_LSPRTHR_MCQ)]<-NA
track.BL$PASE_Q3A<-as.numeric(track.BL$PASE_Q3A)


#Q4: Moderate Sports or Activity Frequency
track.BL$PASE_Q4<-NA
track.BL$PASE_Q4[track.BL$PA2_MSPRT_MCQ==1]<-0
track.BL$PASE_Q4[track.BL$PA2_MSPRT_MCQ==2]<-0.11
track.BL$PASE_Q4[track.BL$PA2_MSPRT_MCQ==3]<-0.25
track.BL$PASE_Q4[track.BL$PA2_MSPRT_MCQ==4]<-0.43
track.BL$PASE_Q4[track.BL$PA2_MSPRT_MCQ>4]<-NA
track.BL$PASE_Q4[is.na(track.BL$PA2_MSPRT_MCQ)]<-NA

track.BL$PASE_Q4A<- NA
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ==1]<-0
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ==2]<-1
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ==3]<-3
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ==4]<-6
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ==5]<-10
track.BL$PASE_Q4A[track.BL$PA2_MSPRTHR_MCQ>5]<-NA
track.BL$PASE_Q4A[track.BL$PA2_MSPRT_MCQ == 1 | is.na(track.BL$PA2_MSPRTHR_MCQ)]<-0
track.BL$PASE_Q4A[is.na(track.BL$PA2_MSPRT_MCQ) & is.na(track.BL$PA2_MSPRTHR_MCQ)]<-NA
track.BL$PASE_Q4A[track.BL$PA2_MSPRT_MCQ>4 & is.na(track.BL$PA2_MSPRTHR_MCQ)]<-NA
track.BL$PASE_Q4A<-as.numeric(track.BL$PASE_Q4A)


#Q5: Strenuous Sports or Activity Frequency
track.BL$PASE_Q5<-NA
track.BL$PASE_Q5[track.BL$PA2_SSPRT_MCQ==1]<-0
track.BL$PASE_Q5[track.BL$PA2_SSPRT_MCQ==2]<-0.11
track.BL$PASE_Q5[track.BL$PA2_SSPRT_MCQ==3]<-0.25
track.BL$PASE_Q5[track.BL$PA2_SSPRT_MCQ==4]<-0.43
track.BL$PASE_Q5[track.BL$PA2_SSPRT_MCQ>4]<-NA
track.BL$PASE_Q5[is.na(track.BL$PA2_SSPRT_MCQ)]<-NA

track.BL$PASE_Q5A<- NA
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ==1]<-0
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ==2]<-1
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ==3]<-3
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ==4]<-6
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ==5]<-10
track.BL$PASE_Q5A[track.BL$PA2_SSPRTHR_MCQ>5]<-NA
track.BL$PASE_Q5A[track.BL$PA2_SSPRT_MCQ == 1 | is.na(track.BL$PA2_SSPRTHR_MCQ)]<-0
track.BL$PASE_Q5A[is.na(track.BL$PA2_SSPRT_MCQ) & is.na(track.BL$PA2_SSPRTHR_MCQ)]<-NA
track.BL$PASE_Q5A[track.BL$PA2_SSPRT_MCQ>4 & is.na(track.BL$PA2_SSPRTHR_MCQ)]<-NA
track.BL$PASE_Q5A<-as.numeric(track.BL$PASE_Q5A)


#Q6: Muscle strengthening and endurance exercise
track.BL$PASE_Q6<-NA
track.BL$PASE_Q6[track.BL$PA2_EXER_MCQ==1]<-0
track.BL$PASE_Q6[track.BL$PA2_EXER_MCQ==2]<-0.11
track.BL$PASE_Q6[track.BL$PA2_EXER_MCQ==3]<-0.25
track.BL$PASE_Q6[track.BL$PA2_EXER_MCQ==4]<-0.43
track.BL$PASE_Q6[track.BL$PA2_EXER_MCQ>4]<-NA
track.BL$PASE_Q6[is.na(track.BL$PA2_EXER_MCQ)]<-NA

track.BL$PASE_Q6A<- NA
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ==1]<-0
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ==2]<-1
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ==3]<-3
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ==4]<-6
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ==5]<-10
track.BL$PASE_Q6A[track.BL$PA2_EXERHR_MCQ>5]<-NA
track.BL$PASE_Q6A[track.BL$PA2_EXER_MCQ == 1 | is.na(track.BL$PA2_EXERHR_MCQ)]<-0
track.BL$PASE_Q6A[is.na(track.BL$PA2_EXER_MCQ) & is.na(track.BL$PA2_EXERHR_MCQ)]<-NA
track.BL$PASE_Q6A[track.BL$PA2_EXER_MCQ>4 & is.na(track.BL$PA2_EXERHR_MCQ)]<-NA
track.BL$PASE_Q6A<-as.numeric(track.BL$PASE_Q6A)


#Q7: Light Housework
track.BL$PASE_Q7<-NA
track.BL$PASE_Q7[track.BL$PA2_LTHSWK_MCQ==1]<-1
track.BL$PASE_Q7[track.BL$PA2_LTHSWK_MCQ==2]<-0
track.BL$PASE_Q7[track.BL$PA2_LTHSWK_MCQ>2]<-NA
track.BL$PASE_Q7[is.na(track.BL$PA2_LTHSWK_MCQ)]<-NA
track.BL$PASE_Q7<-as.numeric(track.BL$PASE_Q7)


#Q8: Heavy Housework
track.BL$PASE_Q8<-NA
track.BL$PASE_Q8[track.BL$PA2_HVYHSWK_MCQ==1]<-1
track.BL$PASE_Q8[track.BL$PA2_HVYHSWK_MCQ==2]<-0
track.BL$PASE_Q8[track.BL$PA2_HVYHSWK_MCQ>2]<-NA
track.BL$PASE_Q8[is.na(track.BL$PA2_HVYHSWK_MCQ)]<-NA
track.BL$PASE_Q8<-as.numeric(track.BL$PASE_Q8)


#Q9: Home Repair, Yardwork, Gardening, Care for another person
track.BL$PASE_Q9A<-NA
track.BL$PASE_Q9A[track.BL$PA2_HMREPAIR_MCQ==1]<-1
track.BL$PASE_Q9A[track.BL$PA2_HMREPAIR_MCQ==2]<-0
track.BL$PASE_Q9A[track.BL$PA2_HMREPAIR_MCQ>2]<-NA
track.BL$PASE_Q9A[is.na(track.BL$PA2_HMREPAIR_MCQ)]<-NA
track.BL$PASE_Q9A<-as.numeric(track.BL$PASE_Q9A)

track.BL$PASE_Q9B<-NA
track.BL$PASE_Q9B[track.BL$PA2_HVYODA_MCQ==1]<-1
track.BL$PASE_Q9B[track.BL$PA2_HVYODA_MCQ==2]<-0
track.BL$PASE_Q9B[track.BL$PA2_HVYODA_MCQ>2]<-NA
track.BL$PASE_Q9B[is.na(track.BL$PA2_HVYODA_MCQ)]<-NA
track.BL$PASE_Q9B<-as.numeric(track.BL$PASE_Q9B)

track.BL$PASE_Q9C<-NA
track.BL$PASE_Q9C[track.BL$PA2_LTODA_MCQ==1]<-1
track.BL$PASE_Q9C[track.BL$PA2_LTODA_MCQ==2]<-0
track.BL$PASE_Q9C[track.BL$PA2_LTODA_MCQ>2]<-NA
track.BL$PASE_Q9C[is.na(track.BL$PA2_LTODA_MCQ)]<-NA
track.BL$PASE_Q9C<-as.numeric(track.BL$PASE_Q9C)

track.BL$PASE_Q9D<-NA
track.BL$PASE_Q9D[track.BL$PA2_CRPRSN_MCQ==1]<-1
track.BL$PASE_Q9D[track.BL$PA2_CRPRSN_MCQ==2]<-0
track.BL$PASE_Q9D[track.BL$PA2_CRPRSN_MCQ>2]<-NA
track.BL$PASE_Q9D[is.na(track.BL$PA2_CRPRSN_MCQ)]<-NA
track.BL$PASE_Q9D<-as.numeric(track.BL$PASE_Q9D)

#Q10: Working and Volunteering
track.BL$PASE_Q10<-NA
track.BL$PASE_Q10[track.BL$PA2_WRK_MCQ==1]<-1
track.BL$PASE_Q10[track.BL$PA2_WRK_MCQ==2]<-0
track.BL$PASE_Q10[track.BL$PA2_WRK_MCQ>2]<-NA
track.BL$PASE_Q10[is.na(track.BL$PA2_WRK_MCQ)]<-NA
track.BL$PASE_Q10<-as.numeric(track.BL$PASE_Q10)

track.BL$PASE_Q10A<-NA
track.BL$PASE_Q10A<-track.BL$PA2_WRKHRS_NB_MCQ
track.BL$PASE_Q10A[track.BL$PA2_WRKHRS_NB_MCQ>=700]<-NA
track.BL$PASE_Q10A[track.BL$PA2_WRK_MCQ == 2 | is.na(track.BL$PA2_WRKHRS_NB_MCQ)]<-0
track.BL$PASE_Q10A[is.na(track.BL$PA2_WRK_MCQ) & is.na(track.BL$PA2_WRKHRS_NB_MCQ)]<-NA
track.BL$PASE_Q10A<-as.numeric(track.BL$PASE_Q10A)
track.BL$PASE_Q10A<-track.BL$PASE_Q10A/7

#PASE TOTAL SCORE#
track.BL$PASE_TOTAL<-track.BL$PASE_Q2*track.BL$PASE_Q2A*20 + track.BL$PASE_Q3*track.BL$PASE_Q3A*21 +  track.BL$PASE_Q4*track.BL$PASE_Q4A*23 + track.BL$PASE_Q5*track.BL$PASE_Q5A*30 +
  track.BL$PASE_Q6*track.BL$PASE_Q6A*30 + (track.BL$PASE_Q7+track.BL$PASE_Q8)*25 + track.BL$PASE_Q9A*30 + track.BL$PASE_Q9B*36 + track.BL$PASE_Q9C*20 + track.BL$PASE_Q9D*35 + 
  track.BL$PASE_Q10*track.BL$PASE_Q10A*21


#BMI
track.BL$BMI<-track.BL$HWT_DBMI_TRM
track.BL$BMI[track.BL$HWT_DBMI_TRM>100]<-NA

#CESD-10
track.BL$CESD_10<-track.BL$DEP_CESD10_TRM
track.BL$CESD_10[track.BL$DEP_CESD10_TRM>50]<-NA
track.BL$CESD_10[track.BL$DEP_CESD10_TRM==-88]<-NA

#Subjective Cognitive Impairment
track.BL$SCI<- NA
track.BL$SCI[track.BL$CCT_MEMPB_TRM==1]<- "Yes"
track.BL$SCI[track.BL$CCT_MEMPB_TRM==2]<- "No"

#Dementia and AD
track.BL$Dementia<- NA
track.BL$Dementia[track.BL$CCT_ALZH_TRM==1]<- "Yes"
track.BL$Dementia[track.BL$CCT_ALZH_TRM==2]<- "No"

#Anxiety
track.BL$Anxiety<- NA
track.BL$Anxiety[track.BL$CCT_ANXI_TRM==1]<- "Yes"
track.BL$Anxiety[track.BL$CCT_ANXI_TRM==2]<- "No"

#Mood Disorders
track.BL$Mood_Disord<- NA
track.BL$Mood_Disord[track.BL$CCT_MOOD_TRM==1]<- "Yes"
track.BL$Mood_Disord[track.BL$CCT_MOOD_TRM==2]<- "No"

#Pet Ownership at Baseline
track.BL$Pet_Owner<-NA
track.BL$Pet_Owner[track.BL$SSA_PET_TRM==1]<-"Yes"
track.BL$Pet_Owner[track.BL$SSA_PET_TRM==2]<-"No"

#Number of Chronic Conditions
track.BL$Chronic_conditions<-NA

track.BL$CCT_HEART_TRM[track.BL$CCT_HEART_TRM==1]<- 1 #Heart Disease
track.BL$CCT_HEART_TRM[track.BL$CCT_HEART_TRM==2]<- 0
track.BL$CCT_HEART_TRM[track.BL$CCT_HEART_TRM==8]<- NA
track.BL$CCT_HEART_TRM[track.BL$CCT_HEART_TRM==9]<- NA

track.BL$CCT_PVD_TRM[track.BL$CCT_PVD_TRM==1]<- 1 #peripheral vascular disease
track.BL$CCT_PVD_TRM[track.BL$CCT_PVD_TRM==2]<- 0
track.BL$CCT_PVD_TRM[track.BL$CCT_PVD_TRM==8]<- NA
track.BL$CCT_PVD_TRM[track.BL$CCT_PVD_TRM==9]<- NA

track.BL$CCT_MEMPB_TRM[track.BL$CCT_MEMPB_TRM==1]<- 1 #SCI
track.BL$CCT_MEMPB_TRM[track.BL$CCT_MEMPB_TRM==2]<- 0
track.BL$CCT_MEMPB_TRM[track.BL$CCT_MEMPB_TRM==8]<- NA
track.BL$CCT_MEMPB_TRM[track.BL$CCT_MEMPB_TRM==9]<- NA

track.BL$CCT_ALZH_TRM[track.BL$CCT_ALZH_TRM==1]<- 1 #Alzheimers or demeinta
track.BL$CCT_ALZH_TRM[track.BL$CCT_ALZH_TRM==2]<- 0
track.BL$CCT_ALZH_TRM[track.BL$CCT_ALZH_TRM==8]<- NA
track.BL$CCT_ALZH_TRM[track.BL$CCT_ALZH_TRM==9]<- NA

track.BL$CCT_MS_TRM[track.BL$CCT_MS_TRM==1]<- 1 #Multiple sclerosis
track.BL$CCT_MS_TRM[track.BL$CCT_MS_TRM==2]<- 0
track.BL$CCT_MS_TRM[track.BL$CCT_MS_TRM==8]<- NA
track.BL$CCT_MS_TRM[track.BL$CCT_MS_TRM==9]<- NA

track.BL$CCT_EPIL_TRM[track.BL$CCT_EPIL_TRM==1]<- 1 #Epilepsy
track.BL$CCT_EPIL_TRM[track.BL$CCT_EPIL_TRM==2]<- 0
track.BL$CCT_EPIL_TRM[track.BL$CCT_EPIL_TRM==8]<- NA
track.BL$CCT_EPIL_TRM[track.BL$CCT_EPIL_TRM==9]<- NA

track.BL$CCT_MGRN_TRM[track.BL$CCT_MGRN_TRM==1]<- 1 #Migraine headaches
track.BL$CCT_MGRN_TRM[track.BL$CCT_MGRN_TRM==2]<- 0
track.BL$CCT_MGRN_TRM[track.BL$CCT_MGRN_TRM==8]<- NA
track.BL$CCT_MGRN_TRM[track.BL$CCT_MGRN_TRM==9]<- NA

track.BL$CCT_ULCR_TRM[track.BL$CCT_ULCR_TRM==1]<- 1 #Intenstinal or stomach ulcers
track.BL$CCT_ULCR_TRM[track.BL$CCT_ULCR_TRM==2]<- 0
track.BL$CCT_ULCR_TRM[track.BL$CCT_ULCR_TRM==8]<- NA
track.BL$CCT_ULCR_TRM[track.BL$CCT_ULCR_TRM==9]<- NA

track.BL$CCT_IBDIBS_TRM[track.BL$CCT_IBDIBS_TRM==1]<- 1 #Bowel disorder
track.BL$CCT_IBDIBS_TRM[track.BL$CCT_IBDIBS_TRM==2]<- 0
track.BL$CCT_IBDIBS_TRM[track.BL$CCT_IBDIBS_TRM==8]<- NA
track.BL$CCT_IBDIBS_TRM[track.BL$CCT_IBDIBS_TRM==9]<- NA

track.BL$CCT_BOWINC_TRM[track.BL$CCT_BOWINC_TRM==1]<- 1 #Bowel incontinence
track.BL$CCT_BOWINC_TRM[track.BL$CCT_BOWINC_TRM==2]<- 0
track.BL$CCT_BOWINC_TRM[track.BL$CCT_BOWINC_TRM==8]<- NA
track.BL$CCT_BOWINC_TRM[track.BL$CCT_BOWINC_TRM==9]<- NA

track.BL$CCT_URIINC_TRM[track.BL$CCT_URIINC_TRM==1]<- 1 #Urinary incontinence
track.BL$CCT_URIINC_TRM[track.BL$CCT_URIINC_TRM==2]<- 0
track.BL$CCT_URIINC_TRM[track.BL$CCT_URIINC_TRM==8]<- NA
track.BL$CCT_URIINC_TRM[track.BL$CCT_URIINC_TRM==9]<- NA

track.BL$CCT_MACDEG_TRM[track.BL$CCT_MACDEG_TRM==1]<- 1 #Macular degeneration
track.BL$CCT_MACDEG_TRM[track.BL$CCT_MACDEG_TRM==2]<- 0
track.BL$CCT_MACDEG_TRM[track.BL$CCT_MACDEG_TRM==8]<- NA
track.BL$CCT_MACDEG_TRM[track.BL$CCT_MACDEG_TRM==9]<- NA

track.BL$CCT_CANC_TRM[track.BL$CCT_CANC_TRM==1]<- 1 #All-cause cancer
track.BL$CCT_CANC_TRM[track.BL$CCT_CANC_TRM==2]<- 0
track.BL$CCT_CANC_TRM[track.BL$CCT_CANC_TRM==8]<- NA
track.BL$CCT_CANC_TRM[track.BL$CCT_CANC_TRM==9]<- NA

track.BL$CCT_BCKP_TRM[track.BL$CCT_BCKP_TRM==1]<- 1 #Back problems but not fibromyalgia or arthritis
track.BL$CCT_BCKP_TRM[track.BL$CCT_BCKP_TRM==2]<- 0
track.BL$CCT_BCKP_TRM[track.BL$CCT_BCKP_TRM==8]<- NA
track.BL$CCT_BCKP_TRM[track.BL$CCT_BCKP_TRM==9]<- NA

track.BL$CCT_KIDN_TRM[track.BL$CCT_KIDN_TRM==1]<- 1 #Kidney disease
track.BL$CCT_KIDN_TRM[track.BL$CCT_KIDN_TRM==2]<- 0
track.BL$CCT_KIDN_TRM[track.BL$CCT_KIDN_TRM==8]<- NA
track.BL$CCT_KIDN_TRM[track.BL$CCT_KIDN_TRM==9]<- NA

track.BL$CCT_OTCCT_TRM[track.BL$CCT_OTCCT_TRM==1]<- 1 #Other long term mental or physical condition
track.BL$CCT_OTCCT_TRM[track.BL$CCT_OTCCT_TRM==2]<- 0
track.BL$CCT_OTCCT_TRM[track.BL$CCT_OTCCT_TRM==8]<- NA
track.BL$CCT_OTCCT_TRM[track.BL$CCT_OTCCT_TRM==9]<- NA

track.BL$CCT_OAHAND_TRM[track.BL$CCT_OAHAND_TRM==1]<- 1 #Hand arthritis
track.BL$CCT_OAHAND_TRM[track.BL$CCT_OAHAND_TRM==2]<- 0
track.BL$CCT_OAHAND_TRM[track.BL$CCT_OAHAND_TRM==8]<- NA
track.BL$CCT_OAHAND_TRM[track.BL$CCT_OAHAND_TRM==9]<- NA

track.BL$CCT_OAHIP_TRM[track.BL$CCT_OAHIP_TRM==1]<- 1 #Hip arthritis
track.BL$CCT_OAHIP_TRM[track.BL$CCT_OAHIP_TRM==2]<- 0
track.BL$CCT_OAHIP_TRM[track.BL$CCT_OAHIP_TRM==8]<- NA
track.BL$CCT_OAHIP_TRM[track.BL$CCT_OAHIP_TRM==9]<- NA

track.BL$CCT_OAKNEE_TRM[track.BL$CCT_OAKNEE_TRM==1]<- 1 #Knee arthritis
track.BL$CCT_OAKNEE_TRM[track.BL$CCT_OAKNEE_TRM==2]<- 0
track.BL$CCT_OAKNEE_TRM[track.BL$CCT_OAKNEE_TRM==8]<- NA
track.BL$CCT_OAKNEE_TRM[track.BL$CCT_OAKNEE_TRM==9]<- NA

track.BL$CCT_RA_TRM[track.BL$CCT_RA_TRM==1]<- 1 #Rheumatoid arthritis
track.BL$CCT_RA_TRM[track.BL$CCT_RA_TRM==2]<- 0
track.BL$CCT_RA_TRM[track.BL$CCT_RA_TRM==8]<- NA
track.BL$CCT_RA_TRM[track.BL$CCT_RA_TRM==9]<- NA

track.BL$CCT_OTART_TRM[track.BL$CCT_OTART_TRM==1]<- 1 #Other arthritis
track.BL$CCT_OTART_TRM[track.BL$CCT_OTART_TRM==2]<- 0
track.BL$CCT_OTART_TRM[track.BL$CCT_OTART_TRM==8]<- NA
track.BL$CCT_OTART_TRM[track.BL$CCT_OTART_TRM==9]<- NA

track.BL$CCT_DIAB_TRM[track.BL$CCT_DIAB_TRM==1]<- 1 #Diabetes
track.BL$CCT_DIAB_TRM[track.BL$CCT_DIAB_TRM==2]<- 0
track.BL$CCT_DIAB_TRM[track.BL$CCT_DIAB_TRM==8]<- NA
track.BL$CCT_DIAB_TRM[track.BL$CCT_DIAB_TRM==9]<- NA

track.BL$CCT_HBP_TRM[track.BL$CCT_HBP_TRM==1]<- 1 #High blood pressure
track.BL$CCT_HBP_TRM[track.BL$CCT_HBP_TRM==2]<- 0
track.BL$CCC_HBP_COM[track.BL$CCT_HBP_TRM==8]<- NA
track.BL$CCT_HBP_TRM[track.BL$CCT_HBP_TRM==9]<- NA

track.BL$CCT_UTHYR_TRM[track.BL$CCT_UTHYR_TRM==1]<- 1 #Under active thyroid
track.BL$CCT_UTHYR_TRM[track.BL$CCT_UTHYR_TRM==2]<- 0
track.BL$CCT_UTHYR_TRM[track.BL$CCT_UTHYR_TRM==8]<- NA
track.BL$CCT_UTHYR_TRM[track.BL$CCT_UTHYR_TRM==9]<- NA

track.BL$CCT_ANGI_TRM[track.BL$CCT_ANGI_TRM==1]<- 1 #Angina
track.BL$CCT_ANGI_TRM[track.BL$CCT_ANGI_TRM==2]<- 0
track.BL$CCT_ANGI_TRM[track.BL$CCT_ANGI_TRM==8]<- NA
track.BL$CCT_ANGI_TRM[track.BL$CCT_ANGI_TRM==9]<- NA

track.BL$CCT_CVA_TRM[track.BL$CCT_CVA_TRM==1]<- 1 #Stroke or CVA
track.BL$CCT_CVA_TRM[track.BL$CCT_CVA_TRM==2]<- 0
track.BL$CCT_CVA_TRM[track.BL$CCT_CVA_TRM==8]<- NA
track.BL$CCT_CVA_TRM[track.BL$CCT_CVA_TRM==9]<- NA

track.BL$CCT_AMI_TRM[track.BL$CCT_AMI_TRM==1]<- 1 #myocardial infarction
track.BL$CCT_AMI_TRM[track.BL$CCT_AMI_TRM==2]<- 0
track.BL$CCT_AMI_TRM[track.BL$CCT_AMI_TRM==8]<- NA
track.BL$CCT_AMI_TRM[track.BL$CCT_AMI_TRM==9]<- NA

track.BL$CCT_OTHYR_TRM[track.BL$CCT_OTHYR_TRM==1]<- 1 #Overactive thyroid
track.BL$CCT_OTHYR_TRM[track.BL$CCT_OTHYR_TRM==2]<- 0
track.BL$CCT_OTHYR_TRM[track.BL$CCT_OTHYR_TRM==8]<- NA
track.BL$CCT_OTHYR_TRM[track.BL$CCT_OTHYR_TRM==9]<- NA

track.BL$CCT_TIA_TRM[track.BL$CCT_TIA_TRM==1]<- 1 #Transient Ischemic Attack
track.BL$CCT_TIA_TRM[track.BL$CCT_TIA_TRM==2]<- 0
track.BL$CCT_TIA_TRM[track.BL$CCT_TIA_TRM==8]<- NA
track.BL$CCT_TIA_TRM[track.BL$CCT_TIA_TRM==9]<- NA

track.BL$CCT_ASTHM_TRM[track.BL$CCT_ASTHM_TRM==1]<- 1 #Asthma
track.BL$CCT_ASTHM_TRM[track.BL$CCT_ASTHM_TRM==2]<- 0
track.BL$CCT_ASTHM_TRM[track.BL$CCT_ASTHM_TRM==8]<- NA
track.BL$CCT_ASTHM_TRM[track.BL$CCT_ASTHM_TRM==9]<- NA

track.BL$CCT_OSTPO_TRM[track.BL$CCT_OSTPO_TRM==1]<- 1 #Osteoperosis
track.BL$CCT_OSTPO_TRM[track.BL$CCT_OSTPO_TRM==2]<- 0
track.BL$CCT_OSTPO_TRM[track.BL$CCT_OSTPO_TRM==8]<- NA
track.BL$CCT_OSTPO_TRM[track.BL$CCT_OSTPO_TRM==9]<- NA

track.BL$CCT_PARK_TRM[track.BL$CCT_PARK_TRM==1]<- 1 #Parkinsons
track.BL$CCT_PARK_TRM[track.BL$CCT_PARK_TRM==2]<- 0
track.BL$CCT_PARK_TRM[track.BL$CCT_PARK_TRM==8]<- NA
track.BL$CCT_PARK_TRM[track.BL$CCT_PARK_TRM==9]<- NA

track.BL$CCT_COPD_TRM[track.BL$CCT_COPD_TRM==1]<- 1 #COPD
track.BL$CCT_COPD_TRM[track.BL$CCT_COPD_TRM==2]<- 0
track.BL$CCT_COPD_TRM[track.BL$CCT_COPD_TRM==8]<- NA
track.BL$CCT_COPD_TRM[track.BL$CCT_COPD_TRM==9]<- NA

track.BL$Chronic_conditions<-track.BL$CCT_HEART_TRM + track.BL$CCT_PVD_TRM + track.BL$CCT_MEMPB_TRM + track.BL$CCT_ALZH_TRM + track.BL$CCT_MS_TRM + 
  track.BL$CCT_EPIL_TRM + track.BL$CCT_MGRN_TRM + track.BL$CCT_ULCR_TRM +
  track.BL$CCT_IBDIBS_TRM + track.BL$CCT_BOWINC_TRM + track.BL$CCT_URIINC_TRM + track.BL$CCT_MACDEG_TRM + track.BL$CCT_CANC_TRM + track.BL$CCT_BCKP_TRM + track.BL$CCT_KIDN_TRM + 
  track.BL$CCT_OTCCT_TRM + track.BL$CCT_OAHAND_TRM + track.BL$CCT_OAHIP_TRM + track.BL$CCT_OAKNEE_TRM + track.BL$CCT_RA_TRM + track.BL$CCT_OTART_TRM +
  track.BL$CCT_DIAB_TRM + track.BL$CCT_HBP_TRM + track.BL$CCT_UTHYR_TRM + track.BL$CCT_ANGI_TRM + track.BL$CCT_CVA_TRM + track.BL$CCT_AMI_TRM + track.BL$CCT_OTHYR_TRM + 
  track.BL$CCT_TIA_TRM + track.BL$CCT_ASTHM_TRM + track.BL$CCT_OSTPO_TRM + track.BL$CCT_PARK_TRM + track.BL$CCT_COPD_TRM

track.BL.1<-track.BL[c(1,3,4,71:79,100:108)]

names(track.BL.1) <-paste(names(track.BL.1),"_0", sep="")

track.BL.Final<- rename(track.BL.1, "ID" = "entity_id_0")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Baseline (Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
track.BLcogs<-trackBL[c(1,1010,1011,1068,1055,1067,1065,1066,995,1058)]

############Cognitive Function##############

#~~~~~~Animal Fluency~~~~~~~~~~~#
track.BLcogs$Animal_Fluency_Lang<-NA
track.BLcogs$Animal_Fluency_Lang[track.BLcogs$COG_AFT_STARTLANG_TRM=="en"]<-"English"
track.BLcogs$Animal_Fluency_Lang[track.BLcogs$COG_AFT_STARTLANG_TRM=="fr"]<-"French"

track.BLcogs$Animal_Fluency_Strict<-track.BLcogs$COG_AFT_SCORE_1_TRM
track.BLcogs$Animal_Fluency_Lenient<-track.BLcogs$COG_AFT_SCORE_2_TRM



#~~~~~~~~Mental Alteration Test~~~~~~~~~~#
track.BLcogs$MAT_Lang<-NA
track.BLcogs$MAT_Lang[track.BLcogs$COG_MAT_STARTLANG_TRM=="en"]<-"English"
track.BLcogs$MAT_Lang[track.BLcogs$COG_MAT_STARTLANG_TRM=="fr"]<-"French"

track.BLcogs$MAT_Score<-track.BLcogs$COG_MAT_SCORE_TRM

#~~~~~~~~RVLT~~~~~~~~~~~~~~~~#
#Rey-Immediate Recall
track.BLcogs$RVLT_Immediate_Lang<- NA
track.BLcogs$RVLT_Immediate_Lang[track.BLcogs$COG_REYI_STARTLANG_TRM=="en"]<-"English"
track.BLcogs$RVLT_Immediate_Lang[track.BLcogs$COG_REYI_STARTLANG_TRM=="fr"]<-"French"

track.BLcogs$RVLT_Immediate_Score<-track.BLcogs$COG_REYI_SCORE_TRM

#Rey-Delayed Recall
track.BLcogs$RVLT_Delayed_Lang<- NA
track.BLcogs$RVLT_Delayed_Lang[track.BLcogs$COG_REYII_STARTLANG_TRM=="en"]<-"English"
track.BLcogs$RVLT_Delayed_Lang[track.BLcogs$COG_REYII_STARTLANG_TRM=="fr"]<-"French"

track.BLcogs$RVLT_Delayed_Score<-track.BLcogs$COG_REYII_SCORE_TRM

track.BLcogs1 <- track.BLcogs[c(1,11:19)]

names(track.BLcogs1) <-paste(names(track.BLcogs1),"_0", sep="")

track.BLcogs.Final<- rename(track.BLcogs1, "ID" = "entity_id_0")

1.2.2) Follow-up 1 processing

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#FU1 (Non-Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
setwd("~/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data/23SP001_McMaster_PRaina_FUP1")

trackFU1<-read.csv("/Users/ryan/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data/23SP001_McMaster_PRaina_FUP1/23SP001_McMaster_PRaina_FUP1_Trav3-1.csv")#Comprehensive Cohort Baseline

track.FU1<-trackFU1[c(1,75,76,594,83,1105,78,1859,134,155,174,181,187,204,201,210,223,228,240,
                      244,252,140,157,163,176,183,190,256,258,1832,1842,444,448,495,496,770,
                      423,434,451,575,455,458,461,462,463,470,473,514,523,537,399,396,392,401,
                      404,419,413,519,426,437,430,522,441,407,512,412,546,223)]

#Sex (no variable in FU1)
SexFU1 <- track.FU1 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id, Sex)
track.FU1$Sex<-SexFU1$Sex


#Age
track.FU1$Age<-track.FU1$AGE_NMBR_TRF1

#Marital Status
track.FU1$Relationship_status<-NA
track.FU1$Relationship_status[track.FU1$SDC_MRTL_TRF1==1]<-"Single"
track.FU1$Relationship_status[track.FU1$SDC_MRTL_TRF1==2]<-"Married"
track.FU1$Relationship_status[track.FU1$SDC_MRTL_TRF1==3]<-"Widowed"
track.FU1$Relationship_status[track.FU1$SDC_MRTL_TRF1==4]<-"Divorced"
track.FU1$Relationship_status[track.FU1$SDC_MRTL_TRF1==5]<-"Separated"

#Education 4 Category (No variable in FU1)
EducationFU1 <- track.FU1 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id,Education4)
track.FU1$Education4<-EducationFU1$Education4

#Household Income
track.FU1$Income_Level<-NA
track.FU1$Income_Level[track.FU1$INC_PTOT_TRF1==1]<-"<$20k"
track.FU1$Income_Level[track.FU1$INC_PTOT_TRF1==2]<-"$20-50k"
track.FU1$Income_Level[track.FU1$INC_PTOT_TRF1==3]<-"$50-100k"
track.FU1$Income_Level[track.FU1$INC_PTOT_TRF1==4]<-"$100-150k"
track.FU1$Income_Level[track.FU1$INC_PTOT_TRF1==5]<-">$150k"

#Living Status
track.FU1$Living_status<-NA
track.FU1$Living_status[track.FU1$OWN_DWLG_TRF1==1]<-"House"
track.FU1$Living_status[track.FU1$OWN_DWLG_TRF1==2 |track.FU1$OWN_DWLG_TRF1==6]<-"Apartment/Condo/Townhome"
track.FU1$Living_status[track.FU1$OWN_DWLG_TRF1==3]<-"Assisted Living"
track.FU1$Living_status[track.FU1$OWN_DWLG_TRF1==4 | track.FU1$OWN_DWLG_TRF1==5 | track.FU1$OWN_DWLG_TRF1>=7]<-"Other"

#Alcohol      
track.FU1$Alcohol<-NA
track.FU1$Alcohol[track.FU1$ALC_TTM_TRF1==1]<-"Regular drinker (at least once a month)"
track.FU1$Alcohol[track.FU1$ALC_TTM_TRF1==2]<-"Occasional drinker"
track.FU1$Alcohol[track.FU1$ALC_TTM_TRF1==3]<-"Non-drinker"

#Smoking Status (no variable in FU1)
SmokingFU1 <- track.FU1 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id,Smoking_Status)
track.FU1$Smoking_Status<-SmokingFU1$Smoking_Status

#Ethnicity (take from baseline)
EthnicityFU1 <- track.FU1 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id, Ethnicity)
track.FU1$Ethnicity<-EthnicityFU1$Ethnicity

#############Physical Activity Scale for the Elderly######################
#Q1: Sitting Activity Frequency in Past 7 days
track.FU1$PASE_Q1<-NA
track.FU1$PASE_Q1[track.FU1$PA2_SIT_TRF1==1]<-0
track.FU1$PASE_Q1[track.FU1$PA2_SIT_TRF1==2]<-0.11
track.FU1$PASE_Q1[track.FU1$PA2_SIT_TRF1==3]<-0.25
track.FU1$PASE_Q1[track.FU1$PA2_SIT_TRF1==4]<-0.43
track.FU1$PASE_Q1[track.FU1$PA2_SIT_TRF1>4]<-NA
track.FU1$PASE_Q1[is.na(track.FU1$PA2_SIT_TRF1)]<-NA

track.FU1$PASE_Q1B<-NA
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1==1]<-0
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1==2]<-1
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1==3]<-3
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1==4]<-6
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1==5]<-10
track.FU1$PASE_Q1B[track.FU1$PA2_SITHR_TRF1>5]<- 0
track.FU1$PASE_Q1B[is.na(track.FU1$PA2_SITHR_TRF1)]<-NA
track.FU1$PASE_Q1B<-as.numeric(track.FU1$PASE_Q1B)

#Q2: Walking outside frequency
track.FU1$PASE_Q2<- NULL
track.FU1$PASE_Q2[track.FU1$PA2_WALK_TRF1==1]<-0
track.FU1$PASE_Q2[track.FU1$PA2_WALK_TRF1==2]<-0.11
track.FU1$PASE_Q2[track.FU1$PA2_WALK_TRF1==3]<-0.25
track.FU1$PASE_Q2[track.FU1$PA2_WALK_TRF1==4]<-0.43
track.FU1$PASE_Q2[track.FU1$PA2_WALK_TRF1>4]<-NA
track.FU1$PASE_Q2[is.na(track.FU1$PA2_WALK_TRF1)]<-NA

track.FU1$PASE_Q2A<- NA
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1==1]<-0
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1==2]<-1
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1==3]<-3
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1==4]<-6
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1==5]<-10
track.FU1$PASE_Q2A[track.FU1$PA2_WALKHR_TRF1>5]<-NA
track.FU1$PASE_Q2A[is.na(track.FU1$PA2_WALKHR_TRF1)]<-NA
track.FU1$PASE_Q2A<-as.numeric(track.FU1$PASE_Q2A)

#Q3: Light Sports or Activity Frequency
track.FU1$PASE_Q3<- NA
track.FU1$PASE_Q3[track.FU1$PA2_LSPRT_TRF1==1]<-0
track.FU1$PASE_Q3[track.FU1$PA2_LSPRT_TRF1==2]<-0.11
track.FU1$PASE_Q3[track.FU1$PA2_LSPRT_TRF1==3]<-0.25
track.FU1$PASE_Q3[track.FU1$PA2_LSPRT_TRF1==4]<-0.43
track.FU1$PASE_Q3[track.FU1$PA2_LSPRT_TRF1>4]<-NA
track.FU1$PASE_Q3[is.na(track.FU1$PA2_LSPRT_TRF1)]<-NA

track.FU1$PASE_Q3A<- NA
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1==1]<-0
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1==2]<-1
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1==3]<-3
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1==4]<-6
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1==5]<-10
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1>5]<-NA
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1 == 1 | is.na(track.FU1$PA2_LSPRTHR_TRF1)]<-0
track.FU1$PASE_Q3A[is.na(track.FU1$PA2_LSPRT_TRF1) & is.na(track.FU1$PA2_LSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q3A[track.FU1$PA2_LSPRTHR_TRF1>4 & is.na(track.FU1$PA2_LSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q3A<-as.numeric(track.FU1$PASE_Q3A)

#Q4: Moderate Sports or Activity Frequency
track.FU1$PASE_Q4<-NA
track.FU1$PASE_Q4[track.FU1$PA2_MSPRT_TRF1==1]<-0
track.FU1$PASE_Q4[track.FU1$PA2_MSPRT_TRF1==2]<-0.11
track.FU1$PASE_Q4[track.FU1$PA2_MSPRT_TRF1==3]<-0.25
track.FU1$PASE_Q4[track.FU1$PA2_MSPRT_TRF1==4]<-0.43
track.FU1$PASE_Q4[track.FU1$PA2_MSPRT_TRF1>4]<-NA
track.FU1$PASE_Q4[is.na(track.FU1$PA2_MSPRT_TRF1)]<-NA

track.FU1$PASE_Q4A<- NA
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1==1]<-0
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1==2]<-1
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1==3]<-3
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1==4]<-6
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1==5]<-10
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRTHR_TRF1>5]<-NA
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRT_TRF1 == 1 | is.na(track.FU1$PA2_MSPRTHR_TRF1)]<-0
track.FU1$PASE_Q4A[is.na(track.FU1$PA2_MSPRT_TRF1) & is.na(track.FU1$PA2_MSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q4A[track.FU1$PA2_MSPRT_TRF1>4 & is.na(track.FU1$PA2_MSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q4A<-as.numeric(track.FU1$PASE_Q4A)

#Q5: Strenuous Sports or Activity Frequency
track.FU1$PASE_Q5<-NA
track.FU1$PASE_Q5[track.FU1$PA2_SSPRT_TRF1==1]<-0
track.FU1$PASE_Q5[track.FU1$PA2_SSPRT_TRF1==2]<-0.11
track.FU1$PASE_Q5[track.FU1$PA2_SSPRT_TRF1==3]<-0.25
track.FU1$PASE_Q5[track.FU1$PA2_SSPRT_TRF1==4]<-0.43
track.FU1$PASE_Q5[track.FU1$PA2_SSPRT_TRF1>4]<-NA
track.FU1$PASE_Q5[is.na(track.FU1$PA2_SSPRT_TRF1)]<-NA

track.FU1$PASE_Q5A<- NA
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1==1]<-0
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1==2]<-1
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1==3]<-3
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1==4]<-6
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1==5]<-10
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRTHR_TRF1>5]<-NA
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRT_TRF1 == 1 | is.na(track.FU1$PA2_SSPRTHR_TRF1)]<-0
track.FU1$PASE_Q5A[is.na(track.FU1$PA2_SSPRT_TRF1) & is.na(track.FU1$PA2_SSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q5A[track.FU1$PA2_SSPRT_TRF1>4 & is.na(track.FU1$PA2_SSPRTHR_TRF1)]<-NA
track.FU1$PASE_Q5A<-as.numeric(track.FU1$PASE_Q5A)

#Q6: Muscle strengthening and endurance exercise
track.FU1$PASE_Q6<-NA
track.FU1$PASE_Q6[track.FU1$PA2_EXER_TRF1==1]<-0
track.FU1$PASE_Q6[track.FU1$PA2_EXER_TRF1==2]<-0.11
track.FU1$PASE_Q6[track.FU1$PA2_EXER_TRF1==3]<-0.25
track.FU1$PASE_Q6[track.FU1$PA2_EXER_TRF1==4]<-0.43
track.FU1$PASE_Q6[track.FU1$PA2_EXER_TRF1>4]<-NA
track.FU1$PASE_Q6[is.na(track.FU1$PA2_EXER_TRF1)]<-NA

track.FU1$PASE_Q6A<- NA
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1==1]<-0
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1==2]<-1
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1==3]<-3
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1==4]<-6
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1==5]<-10
track.FU1$PASE_Q6A[track.FU1$PA2_EXERHR_TRF1>5]<-NA
track.FU1$PASE_Q6A[track.FU1$PA2_EXER_TRF1 == 1 | is.na(track.FU1$PA2_EXERHR_TRF1)]<-0
track.FU1$PASE_Q6A[is.na(track.FU1$PA2_EXER_TRF1) & is.na(track.FU1$PA2_EXERHR_TRF1)]<-NA
track.FU1$PASE_Q6A[track.FU1$PA2_EXER_TRF1>4 & is.na(track.FU1$PA2_EXERHR_TRF1)]<-NA
track.FU1$PASE_Q6A<-as.numeric(track.FU1$PASE_Q6A)

#Q7: Light Housework
track.FU1$PASE_Q7<-NA
track.FU1$PASE_Q7[track.FU1$PA2_LTHSWK_TRF1==1]<-1
track.FU1$PASE_Q7[track.FU1$PA2_LTHSWK_TRF1==2]<-0
track.FU1$PASE_Q7[track.FU1$PA2_LTHSWK_TRF1>2]<-NA
track.FU1$PASE_Q7[is.na(track.FU1$PA2_LTHSWK_TRF1)]<-NA
track.FU1$PASE_Q7<-as.numeric(track.FU1$PASE_Q7)

#Q8: Heavy Housework
track.FU1$PASE_Q8<-NA
track.FU1$PASE_Q8[track.FU1$PA2_HVYHSWK_TRF1==1]<-1
track.FU1$PASE_Q8[track.FU1$PA2_HVYHSWK_TRF1==2]<-0
track.FU1$PASE_Q8[track.FU1$PA2_HVYHSWK_TRF1>2]<-NA
track.FU1$PASE_Q8[is.na(track.FU1$PA2_HVYHSWK_TRF1)]<-NA
track.FU1$PASE_Q8<-as.numeric(track.FU1$PASE_Q8)

#Q9: Home Repair, Yardwork, Gardening, Care for another person
track.FU1$PASE_Q9A<-NA
track.FU1$PASE_Q9A[track.FU1$PA2_HMREPAIR_TRF1==1]<-1
track.FU1$PASE_Q9A[track.FU1$PA2_HMREPAIR_TRF1==2]<-0
track.FU1$PASE_Q9A[track.FU1$PA2_HMREPAIR_TRF1>2]<-NA
track.FU1$PASE_Q9A[is.na(track.FU1$PA2_HMREPAIR_TRF1)]<-NA
track.FU1$PASE_Q9A<-as.numeric(track.FU1$PASE_Q9A)

track.FU1$PASE_Q9B<-NA
track.FU1$PASE_Q9B[track.FU1$PA2_HVYODA_TRF1==1]<-1
track.FU1$PASE_Q9B[track.FU1$PA2_HVYODA_TRF1==2]<-0
track.FU1$PASE_Q9B[track.FU1$PA2_HVYODA_TRF1>2]<-NA
track.FU1$PASE_Q9B[is.na(track.FU1$PA2_HVYODA_TRF1)]<-NA
track.FU1$PASE_Q9B<-as.numeric(track.FU1$PASE_Q9B)

track.FU1$PASE_Q9C<-NA
track.FU1$PASE_Q9C[track.FU1$PA2_LTODA_TRF1==1]<-1
track.FU1$PASE_Q9C[track.FU1$PA2_LTODA_TRF1==2]<-0
track.FU1$PASE_Q9C[track.FU1$PA2_LTODA_TRF1>2]<-NA
track.FU1$PASE_Q9C[is.na(track.FU1$PA2_LTODA_TRF1)]<-NA
track.FU1$PASE_Q9C<-as.numeric(track.FU1$PASE_Q9C)

track.FU1$PASE_Q9D<-NA
track.FU1$PASE_Q9D[track.FU1$PA2_CRPRSN_TRF1==1]<-1
track.FU1$PASE_Q9D[track.FU1$PA2_CRPRSN_TRF1==2]<-0
track.FU1$PASE_Q9D[track.FU1$PA2_CRPRSN_TRF1>2]<-NA
track.FU1$PASE_Q9D[is.na(track.FU1$PA2_CRPRSN_TRF1)]<-NA
track.FU1$PASE_Q9D<-as.numeric(track.FU1$PASE_Q9D)

#Q10: Working and Volunteering
track.FU1$PASE_Q10<-NA
track.FU1$PASE_Q10[track.FU1$PA2_WRK_TRF1==1]<-1
track.FU1$PASE_Q10[track.FU1$PA2_WRK_TRF1==2]<-0
track.FU1$PASE_Q10[track.FU1$PA2_WRK_TRF1>2]<-NA
track.FU1$PASE_Q10[is.na(track.FU1$PA2_WRK_TRF1)]<-NA
track.FU1$PASE_Q10<-as.numeric(track.FU1$PASE_Q10)

track.FU1$PASE_Q10A<-NA
track.FU1$PASE_Q10A<-track.FU1$PA2_WRKHRS_NB_TRF1
track.FU1$PASE_Q10A[track.FU1$PA2_WRKHRS_NB_TRF1>=700]<-NA
track.FU1$PASE_Q10A[track.FU1$PA2_WRK_TRF1 == 2 | is.na(track.FU1$PA2_WRKHRS_NB_TRF1)]<-0
track.FU1$PASE_Q10A[is.na(track.FU1$PA2_WRK_TRF1) & is.na(track.FU1$PA2_WRKHRS_NB_TRF1)]<-NA
track.FU1$PASE_Q10A<-as.numeric(track.FU1$PASE_Q10A)
track.FU1$PASE_Q10A<-track.FU1$PASE_Q10A/7

#PASE TOTAL SCORE#
track.FU1$PASE_TOTAL<-track.FU1$PASE_Q2*track.FU1$PASE_Q2A*20 + track.FU1$PASE_Q3*track.FU1$PASE_Q3A*21 +  track.FU1$PASE_Q4*track.FU1$PASE_Q4A*23 + track.FU1$PASE_Q5*track.FU1$PASE_Q5A*30 +
  track.FU1$PASE_Q6*track.FU1$PASE_Q6A*30 + (track.FU1$PASE_Q7+track.FU1$PASE_Q8)*25 + track.FU1$PASE_Q9A*30 + track.FU1$PASE_Q9B*36 + track.FU1$PASE_Q9C*20 + track.FU1$PASE_Q9D*35 + 
  track.FU1$PASE_Q10*track.FU1$PASE_Q10A*21

#BMI
track.FU1$BMI<-track.FU1$HWT_DBMI_TRF1
track.FU1$BMI[track.FU1$HWT_DBMI_TRF1>100]<-NA

#CESD-10
track.FU1$CESD_10<-track.FU1$DEP_CESD10_TRF1
track.FU1$CESD_10[track.FU1$DEP_CESD10_TRF1==98]<-NA
track.FU1$CESD_10[track.FU1$DEP_CESD10_TRF1<0]<-NA

#Subjective Cognitive Impairment
track.FU1$SCI<- NA
track.FU1$SCI[track.FU1$CCT_MEMPB_TRF1==1]<- "Yes"
track.FU1$SCI[track.FU1$CCT_MEMPB_TRF1==2]<- "No"

#Dementia and AD
track.FU1$Dementia<- NA
track.FU1$Dementia[track.FU1$CCT_ALZH_TRF1==1]<- "Yes"
track.FU1$Dementia[track.FU1$CCT_ALZH_TRF1==2]<- "No"

#Anxiety
track.FU1$Anxiety<- NA
track.FU1$Anxiety[track.FU1$CCT_ANXI_TRF1==1]<- "Yes"
track.FU1$Anxiety[track.FU1$CCT_ANXI_TRF1==2]<- "No"

#Mood Disorders
track.FU1$Mood_Disord<- NA
track.FU1$Mood_Disord[track.FU1$CCT_MOOD_TRF1==1]<- "Yes"
track.FU1$Mood_Disord[track.FU1$CCT_MOOD_TRF1==2]<- "No"

#Pet Ownership at Baseline
track.FU1$Pet_Owner<-NA
track.FU1$Pet_Owner[track.FU1$SSA_PET_TRF1==1]<-"Yes"
track.FU1$Pet_Owner[track.FU1$SSA_PET_TRF1==2]<-"No"

#Number of Chronic Conditions
track.FU1$Chronic_conditions<-NA

track.FU1$CCT_HEART_TRM[track.FU1$CCT_HEART_TRF1==1]<- 1 #Heart Disease
track.FU1$CCT_HEART_TRM[track.FU1$CCT_HEART_TRF1==2]<- 0
track.FU1$CCT_HEART_TRM[track.FU1$CCT_HEART_TRF1==8]<- NA
track.FU1$CCT_HEART_TRM[track.FU1$CCT_HEART_TRF1==9]<- NA

track.FU1$CCT_PVD_TRM[track.FU1$CCT_PVD_TRF1==1]<- 1 #peripheral vascular disease
track.FU1$CCT_PVD_TRM[track.FU1$CCT_PVD_TRF1==2]<- 0
track.FU1$CCT_PVD_TRM[track.FU1$CCT_PVD_TRF1==8]<- NA
track.FU1$CCT_PVD_TRM[track.FU1$CCT_PVD_TRF1==9]<- NA

track.FU1$CCT_MEMPB_TRM[track.FU1$CCT_MEMPB_TRF1==1]<- 1 #SCI
track.FU1$CCT_MEMPB_TRM[track.FU1$CCT_MEMPB_TRF1==2]<- 0
track.FU1$CCT_MEMPB_TRM[track.FU1$CCT_MEMPB_TRF1==8]<- NA
track.FU1$CCT_MEMPB_TRM[track.FU1$CCT_MEMPB_TRF1==9]<- NA

track.FU1$CCT_ALZH_TRM[track.FU1$CCT_ALZH_TRF1==1]<- 1 #Alzheimers or demeinta
track.FU1$CCT_ALZH_TRM[track.FU1$CCT_ALZH_TRF1==2]<- 0
track.FU1$CCT_ALZH_TRM[track.FU1$CCT_ALZH_TRF1==8]<- NA
track.FU1$CCT_ALZH_TRM[track.FU1$CCT_ALZH_TRF1==9]<- NA

track.FU1$CCT_MS_TRM[track.FU1$CCT_MS_TRF1==1]<- 1 #Multiple sclerosis
track.FU1$CCT_MS_TRM[track.FU1$CCT_MS_TRF1==2]<- 0
track.FU1$CCT_MS_TRM[track.FU1$CCT_MS_TRF1==8]<- NA
track.FU1$CCT_MS_TRM[track.FU1$CCT_MS_TRF1==9]<- NA

track.FU1$CCT_EPIL_TRM[track.FU1$EPI_EVER_TRF1==1]<- 1 #Epilepsy
track.FU1$CCT_EPIL_TRM[track.FU1$EPI_EVER_TRF1==2]<- 0
track.FU1$CCT_EPIL_TRM[track.FU1$EPI_EVER_TRF1==8]<- NA
track.FU1$CCT_EPIL_TRM[track.FU1$EPI_EVER_TRF1==9]<- NA

track.FU1$CCT_MGRN_TRM[track.FU1$CCT_MGRN_TRF1==1]<- 1 #Migraine headaches
track.FU1$CCT_MGRN_TRM[track.FU1$CCT_MGRN_TRF1==2]<- 0
track.FU1$CCT_MGRN_TRM[track.FU1$CCT_MGRN_TRF1==8]<- NA
track.FU1$CCT_MGRN_TRM[track.FU1$CCT_MGRN_TRF1==9]<- NA

track.FU1$CCT_ULCR_TRM[track.FU1$CCT_ULCR_TRF1==1]<- 1 #Intenstinal or stomach ulcers
track.FU1$CCT_ULCR_TRM[track.FU1$CCT_ULCR_TRF1==2]<- 0
track.FU1$CCT_ULCR_TRM[track.FU1$CCT_ULCR_TRF1==8]<- NA
track.FU1$CCT_ULCR_TRM[track.FU1$CCT_ULCR_TRF1==9]<- NA

track.FU1$CCT_IBDIBS_TRM[track.FU1$CCT_IBDIBS_TRF1==1]<- 1 #Bowel disorder
track.FU1$CCT_IBDIBS_TRM[track.FU1$CCT_IBDIBS_TRF1==2]<- 0
track.FU1$CCT_IBDIBS_TRM[track.FU1$CCT_IBDIBS_TRF1==8]<- NA
track.FU1$CCT_IBDIBS_TRM[track.FU1$CCT_IBDIBS_TRF1==9]<- NA

track.FU1$CCT_BOWINC_TRM[track.FU1$CCT_BOWINC_TRF1==1]<- 1 #Bowel incontinence
track.FU1$CCT_BOWINC_TRM[track.FU1$CCT_BOWINC_TRF1==2]<- 0
track.FU1$CCT_BOWINC_TRM[track.FU1$CCT_BOWINC_TRF1==8]<- NA
track.FU1$CCT_BOWINC_TRM[track.FU1$CCT_BOWINC_TRF1==9]<- NA

track.FU1$CCT_URIINC_TRM[track.FU1$CCT_URIINC_TRF1==1]<- 1 #Urinary incontinence
track.FU1$CCT_URIINC_TRM[track.FU1$CCT_URIINC_TRF1==2]<- 0
track.FU1$CCT_URIINC_TRM[track.FU1$CCT_URIINC_TRF1==8]<- NA
track.FU1$CCT_URIINC_TRM[track.FU1$CCT_URIINC_TRF1==9]<- NA

track.FU1$CCT_MACDEG_TRM[track.FU1$CCT_MACDEG_TRF1==1]<- 1 #Macular degeneration
track.FU1$CCT_MACDEG_TRM[track.FU1$CCT_MACDEG_TRF1==2]<- 0
track.FU1$CCT_MACDEG_TRM[track.FU1$CCT_MACDEG_TRF1==8]<- NA
track.FU1$CCT_MACDEG_TRM[track.FU1$CCT_MACDEG_TRF1==9]<- NA

track.FU1$CCT_CANC_TRM[track.FU1$CCT_CANC_TRF1==1]<- 1 #All-cause cancer
track.FU1$CCT_CANC_TRM[track.FU1$CCT_CANC_TRF1==2]<- 0
track.FU1$CCT_CANC_TRM[track.FU1$CCT_CANC_TRF1==8]<- NA
track.FU1$CCT_CANC_TRM[track.FU1$CCT_CANC_TRF1==9]<- NA

track.FU1$CCT_BCKP_TRM[track.FU1$CCT_BCKP_TRF1==1]<- 1 #Back problems but not fibromyalgia or arthritis
track.FU1$CCT_BCKP_TRM[track.FU1$CCT_BCKP_TRF1==2]<- 0
track.FU1$CCT_BCKP_TRM[track.FU1$CCT_BCKP_TRF1==8]<- NA
track.FU1$CCT_BCKP_TRM[track.FU1$CCT_BCKP_TRF1==9]<- NA

track.FU1$CCT_KIDN_TRM[track.FU1$CCT_KIDN_TRF1==1]<- 1 #Kidney disease
track.FU1$CCT_KIDN_TRM[track.FU1$CCT_KIDN_TRF1==2]<- 0
track.FU1$CCT_KIDN_TRM[track.FU1$CCT_KIDN_TRF1==8]<- NA
track.FU1$CCT_KIDN_TRM[track.FU1$CCT_KIDN_TRF1==9]<- NA

track.FU1$CCT_OTCCT_TRM[track.FU1$CCT_OTCCT_TRF1==1]<- 1 #Other long term mental or physical condition
track.FU1$CCT_OTCCT_TRM[track.FU1$CCT_OTCCT_TRF1==2]<- 0
track.FU1$CCT_OTCCT_TRM[track.FU1$CCT_OTCCT_TRF1==8]<- NA
track.FU1$CCT_OTCCT_TRM[track.FU1$CCT_OTCCT_TRF1==9]<- NA

track.FU1$CCT_OAHAND_TRM[track.FU1$CCT_OAHAND_TRF1==1]<- 1 #Hand arthritis
track.FU1$CCT_OAHAND_TRM[track.FU1$CCT_OAHAND_TRF1==2]<- 0
track.FU1$CCT_OAHAND_TRM[track.FU1$CCT_OAHAND_TRF1==8]<- NA
track.FU1$CCT_OAHAND_TRM[track.FU1$CCT_OAHAND_TRF1==9]<- NA

track.FU1$CCT_OAHIP_TRM[track.FU1$CCT_OAHIP_TRF1==1]<- 1 #Hip arthritis
track.FU1$CCT_OAHIP_TRM[track.FU1$CCT_OAHIP_TRF1==2]<- 0
track.FU1$CCT_OAHIP_TRM[track.FU1$CCT_OAHIP_TRF1==8]<- NA
track.FU1$CCT_OAHIP_TRM[track.FU1$CCT_OAHIP_TRF1==9]<- NA

track.FU1$CCT_OAKNEE_TRM[track.FU1$CCT_OAKNEE_TRF1==1]<- 1 #Knee arthritis
track.FU1$CCT_OAKNEE_TRM[track.FU1$CCT_OAKNEE_TRF1==2]<- 0
track.FU1$CCT_OAKNEE_TRM[track.FU1$CCT_OAKNEE_TRF1==8]<- NA
track.FU1$CCT_OAKNEE_TRM[track.FU1$CCT_OAKNEE_TRF1==9]<- NA

track.FU1$CCT_RA_TRM[track.FU1$CCT_RA_TRF1==1]<- 1 #Rheumatoid arthritis
track.FU1$CCT_RA_TRM[track.FU1$CCT_RA_TRF1==2]<- 0
track.FU1$CCT_RA_TRM[track.FU1$CCT_RA_TRF1==8]<- NA
track.FU1$CCT_RA_TRM[track.FU1$CCT_RA_TRF1==9]<- NA

track.FU1$CCT_OTART_TRM[track.FU1$CCT_OTART_TRF1==1]<- 1 #Other arthritis
track.FU1$CCT_OTART_TRM[track.FU1$CCT_OTART_TRF1==2]<- 0
track.FU1$CCT_OTART_TRM[track.FU1$CCT_OTART_TRF1==8]<- NA
track.FU1$CCT_OTART_TRM[track.FU1$CCT_OTART_TRF1==9]<- NA

track.FU1$CCT_DIAB_TRM[track.FU1$CCT_DIAB_TRF1==1]<- 1 #Diabetes
track.FU1$CCT_DIAB_TRM[track.FU1$CCT_DIAB_TRF1==2]<- 0
track.FU1$CCT_DIAB_TRM[track.FU1$CCT_DIAB_TRF1==8]<- NA
track.FU1$CCT_DIAB_TRM[track.FU1$CCT_DIAB_TRF1==9]<- NA

track.FU1$CCT_HBP_TRM[track.FU1$CCT_HBP_TRF1==1]<- 1 #High blood pressure
track.FU1$CCT_HBP_TRM[track.FU1$CCT_HBP_TRF1==2]<- 0
track.FU1$CCT_HBP_TRM[track.FU1$CCT_HBP_TRF1==8]<- NA
track.FU1$CCT_HBP_TRM[track.FU1$CCT_HBP_TRF1==9]<- NA

track.FU1$CCT_UTHYR_TRM[track.FU1$CCT_UTHYR_TRF1==1]<- 1 #Under active thyroid
track.FU1$CCT_UTHYR_TRM[track.FU1$CCT_UTHYR_TRF1==2]<- 0
track.FU1$CCT_UTHYR_TRM[track.FU1$CCT_UTHYR_TRF1==8]<- NA
track.FU1$CCT_UTHYR_TRM[track.FU1$CCT_UTHYR_TRF1==9]<- NA

track.FU1$CCT_ANGI_TRM[track.FU1$CCT_ANGI_TRF1==1]<- 1 #Angina
track.FU1$CCT_ANGI_TRM[track.FU1$CCT_ANGI_TRF1==2]<- 0
track.FU1$CCT_ANGI_TRM[track.FU1$CCT_ANGI_TRF1==8]<- NA
track.FU1$CCT_ANGI_TRM[track.FU1$CCT_ANGI_TRF1==9]<- NA

track.FU1$CCT_CVA_TRM[track.FU1$CCT_CVA_TRF1==1]<- 1 #Stroke or CVA
track.FU1$CCT_CVA_TRM[track.FU1$CCT_CVA_TRF1==2]<- 0
track.FU1$CCT_CVA_TRM[track.FU1$CCT_CVA_TRF1==8]<- NA
track.FU1$CCT_CVA_TRM[track.FU1$CCT_CVA_TRF1==9]<- NA

track.FU1$CCT_AMI_TRM[track.FU1$CCT_AMI_TRF1==1]<- 1 #myocardial infarction
track.FU1$CCT_AMI_TRM[track.FU1$CCT_AMI_TRF1==2]<- 0
track.FU1$CCT_AMI_TRM[track.FU1$CCT_AMI_TRF1==8]<- NA
track.FU1$CCT_AMI_TRM[track.FU1$CCT_AMI_TRF1==9]<- NA

track.FU1$CCT_OTHYR_TRM[track.FU1$CCT_OTHYR_TRF1==1]<- 1 #Overactive thyroid
track.FU1$CCT_OTHYR_TRM[track.FU1$CCT_OTHYR_TRF1==2]<- 0
track.FU1$CCT_OTHYR_TRM[track.FU1$CCT_OTHYR_TRF1==8]<- NA
track.FU1$CCT_OTHYR_TRM[track.FU1$CCT_OTHYR_TRF1==9]<- NA

track.FU1$CCT_TIA_TRM[track.FU1$CCT_TIA_TRF1==1]<- 1 #Transient Ischemic Attack
track.FU1$CCT_TIA_TRM[track.FU1$CCT_TIA_TRF1==2]<- 0
track.FU1$CCT_TIA_TRM[track.FU1$CCT_TIA_TRF1==8]<- NA
track.FU1$CCT_TIA_TRM[track.FU1$CCT_TIA_TRF1==9]<- NA

track.FU1$CCT_ASTHM_TRM[track.FU1$CCT_ASTHM_TRF1==1]<- 1 #Asthma
track.FU1$CCT_ASTHM_TRM[track.FU1$CCT_ASTHM_TRF1==2]<- 0
track.FU1$CCT_ASTHM_TRM[track.FU1$CCT_ASTHM_TRF1==8]<- NA
track.FU1$CCT_ASTHM_TRM[track.FU1$CCT_ASTHM_TRF1==9]<- NA

track.FU1$CCT_OSTPO_TRM[track.FU1$CCT_OSTPO_TRF1==1]<- 1 #Osteoperosis
track.FU1$CCT_OSTPO_TRM[track.FU1$CCT_OSTPO_TRF1==2]<- 0
track.FU1$CCT_OSTPO_TRM[track.FU1$CCT_OSTPO_TRF1==8]<- NA
track.FU1$CCT_OSTPO_TRM[track.FU1$CCT_OSTPO_TRF1==9]<- NA

track.FU1$CCT_PARK_TRM[track.FU1$PKD_PARK_TRF1==1]<- 1 #Parkinsons
track.FU1$CCT_PARK_TRM[track.FU1$PKD_PARK_TRF1==2]<- 0
track.FU1$CCT_PARK_TRM[track.FU1$PKD_PARK_TRF1==8]<- NA
track.FU1$CCT_PARK_TRM[track.FU1$PKD_PARK_TRF1==9]<- NA

track.FU1$CCT_COPD_TRM[track.FU1$CCT_COPD_TRF1==1]<- 1 #COPD
track.FU1$CCT_COPD_TRM[track.FU1$CCT_COPD_TRF1==2]<- 0
track.FU1$CCT_COPD_TRM[track.FU1$CCT_COPD_TRF1==8]<- NA
track.FU1$CCT_COPD_TRM[track.FU1$CCT_COPD_TRF1==9]<- NA

track.FU1$Chronic_conditions<-track.FU1$CCT_HEART_TRM + track.FU1$CCT_PVD_TRM + track.FU1$CCT_MEMPB_TRM + track.FU1$CCT_ALZH_TRM + track.FU1$CCT_MS_TRM +
  track.FU1$CCT_EPIL_TRM + track.FU1$CCT_MGRN_TRM + track.FU1$CCT_ULCR_TRM +
  track.FU1$CCT_IBDIBS_TRM + track.FU1$CCT_BOWINC_TRM + track.FU1$CCT_URIINC_TRM + track.FU1$CCT_MACDEG_TRM + track.FU1$CCT_CANC_TRM + track.FU1$CCT_BCKP_TRM + track.FU1$CCT_KIDN_TRM + 
  track.FU1$CCT_OTCCT_TRM + track.FU1$CCT_OAHAND_TRM + track.FU1$CCT_OAHIP_TRM + track.FU1$CCT_OAKNEE_TRM + track.FU1$CCT_RA_TRM + track.FU1$CCT_OTART_TRM +
  track.FU1$CCT_DIAB_TRM + track.FU1$CCT_HBP_TRM + track.FU1$CCT_UTHYR_TRM + track.FU1$CCT_ANGI_TRM + track.FU1$CCT_CVA_TRM + track.FU1$CCT_AMI_TRM + track.FU1$CCT_OTHYR_TRM + 
  track.FU1$CCT_TIA_TRM + track.FU1$CCT_ASTHM_TRM + track.FU1$CCT_OSTPO_TRM + track.FU1$CCT_PARK_TRM + track.FU1$CCT_COPD_TRM

track.FU1.1<-track.FU1[c(1:3,69:77,98:106)]

names(track.FU1.1) <-paste(names(track.FU1.1),"_1", sep="")

track.FU1.Final<- rename(track.FU1.1, "ID" = "entity_id_1")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#FU1 (Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
track.FU1cogs<-trackFU1[c(1,1927,1928,1876,1875,1966,1877,1914,1878,1969)]

############Cognitive Function##############

#~~~~~~Animal Fluency~~~~~~~~~~~#
track.FU1cogs$Animal_Fluency_Lang<-NA
track.FU1cogs$Animal_Fluency_Lang[track.FU1cogs$COG_AFT_STARTLANG_TRF1=="en"]<-"English"
track.FU1cogs$Animal_Fluency_Lang[track.FU1cogs$COG_AFT_STARTLANG_TRF1=="fr"]<-"French"

track.FU1cogs$Animal_Fluency_Strict<-track.FU1cogs$COG_AFT_SCORE_1_TRF1
track.FU1cogs$Animal_Fluency_Strict[track.FU1cogs$Animal_Fluency_Strict<0]<-NA
track.FU1cogs$Animal_Fluency_Lenient<-track.FU1cogs$COG_AFT_SCORE_2_TRF1
track.FU1cogs$Animal_Fluency_Lenient[track.FU1cogs$Animal_Fluency_Lenient<0]<-NA



#~~~~~~~~Mental Alteration Test~~~~~~~~~~#
track.FU1cogs$MAT_Lang<-NA
track.FU1cogs$MAT_Lang[track.FU1cogs$COG_MAT_STARTLANG_TRF1=="en"]<-"English"
track.FU1cogs$MAT_Lang[track.FU1cogs$COG_MAT_STARTLANG_TRF1=="fr"]<-"French"

track.FU1cogs$MAT_Score<-track.FU1cogs$COG_MAT_SCORE_TRF1
track.FU1cogs$MAT_Score[track.FU1cogs$MAT_Score<0]<-NA

#~~~~~~~~RVLT~~~~~~~~~~~~~~~~#
#Rey-Immediate Recall
track.FU1cogs$RVLT_Immediate_Lang<- NA
track.FU1cogs$RVLT_Immediate_Lang[track.FU1cogs$COG_REYI_LANG_TRF1=="en"]<-"English"
track.FU1cogs$RVLT_Immediate_Lang[track.FU1cogs$COG_REYI_LANG_TRF1=="fr"]<-"French"

track.FU1cogs$RVLT_Immediate_Score<-track.FU1cogs$COG_REYI_SCORE_TRF1
track.FU1cogs$RVLT_Immediate_Score[track.FU1cogs$RVLT_Immediate_Score<0]<-NA


#Rey-Delayed Recall
track.FU1cogs$RVLT_Delayed_Lang<- NA
track.FU1cogs$RVLT_Delayed_Lang[track.FU1cogs$COG_REYII_LANG_TRF1=="en"]<-"English"
track.FU1cogs$RVLT_Delayed_Lang[track.FU1cogs$COG_REYII_LANG_TRF1=="fr"]<-"French"

track.FU1cogs$RVLT_Delayed_Score<-track.FU1cogs$COG_REYII_SCORE_TRF1
track.FU1cogs$RVLT_Delayed_Score[track.FU1cogs$RVLT_Delayed_Score<0]<-NA

track.FU1cogs1 <- track.FU1cogs[c(1,11:19)]

names(track.FU1cogs1) <-paste(names(track.FU1cogs1),"_1", sep="")

track.FU1cogs.Final<- rename(track.FU1cogs1, "ID" = "entity_id_1")

1.2.3) Follow-up 2 processing

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#FU2 (Non-Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
setwd("~/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data/23SP001_McMaster_PRaina_FUP2")

trackFU2<-read.csv("23SP001_McMaster_PRaina_FUP2_Trav1.csv")#Comprehensive Cohort Baseline

track.FU2<-trackFU2[c(1:5,47,1239,14,78,98,111,112,113,114,194,137,157,158,184,185,
                      191,195:202,50:54,685:694,415,419,514,517,732,389,401,423,604,427,
                      431,437,441,445,457,461,542,359,356,352,363,381,375,534,393,403,397,
                      538,407,367,530,371,568)]

#Sex (no variable in FU1)
SexFU2 <- track.FU2 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id, Sex)
track.FU2$Sex<-SexFU2$Sex

#Age
track.FU2$Age<-track.FU2$AGE_NMBR_TRF2

#Marital Status
track.FU2$Relationship_status<-NA
track.FU2$Relationship_status[track.FU2$SDC_MRTL_TRF2==1]<-"Single"
track.FU2$Relationship_status[track.FU2$SDC_MRTL_TRF2==2]<-"Married"
track.FU2$Relationship_status[track.FU2$SDC_MRTL_TRF2==3]<-"Widowed"
track.FU2$Relationship_status[track.FU2$SDC_MRTL_TRF2==4]<-"Divorced"
track.FU2$Relationship_status[track.FU2$SDC_MRTL_TRF2==5]<-"Separated"

#Education 4 Category (No variable in FU2)
EducationFU2 <- track.FU2 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id,Education4)
track.FU2$Education4<-EducationFU2$Education4

#Household Income
track.FU2$Income_Level<-NA
track.FU2$Income_Level[track.FU2$INC_PTOT_TRF2==1]<-"<$20k"
track.FU2$Income_Level[track.FU2$INC_PTOT_TRF2==2]<-"$20-50k"
track.FU2$Income_Level[track.FU2$INC_PTOT_TRF2==3]<-"$50-100k"
track.FU2$Income_Level[track.FU2$INC_PTOT_TRF2==4]<-"$100-150k"
track.FU2$Income_Level[track.FU2$INC_PTOT_TRF2==5]<-">$150k"

#Living Status
track.FU2$Living_status<-NA
track.FU2$Living_status[track.FU2$OWN_DWLG_TRF2==1]<-"House"
track.FU2$Living_status[track.FU2$OWN_DWLG_TRF2==2 |track.FU2$OWN_DWLG_TRF2==6]<-"Apartment/Condo/Townhome"
track.FU2$Living_status[track.FU2$OWN_DWLG_TRF2==3]<-"Assisted Living"
track.FU2$Living_status[track.FU2$OWN_DWLG_TRF2==4 | track.FU2$OWN_DWLG_TRF2==5 | track.FU2$OWN_DWLG_TRF2>=7]<-"Other"

#Alcohol (Based on a different question/scale)     
track.FU2$Alcohol<-NA
track.FU2$Alcohol[track.FU2$ALC_FREQ_TRF2<=6]<-"Regular drinker (at least once a month)"
track.FU2$Alcohol[track.FU2$ALC_FREQ_TRF2==7]<-"Occasional drinker"
track.FU2$Alcohol[track.FU2$ALC_FREQ_TRF2==96]<-"Non-drinker"

#Smoking Status (no variable in FU2)
SmokingFU2 <- track.FU2 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id,Smoking_Status)
track.FU2$Smoking_Status<-SmokingFU2$Smoking_Status

#Ethnicity (take from baseline))
EthnicityFU2 <- track.FU2 %>%
  left_join(track.BL, by = "entity_id") %>%
  select(entity_id,Ethnicity)
track.FU2$Ethnicity<-EthnicityFU2$Ethnicity

#############Physical Activity Scale for the Elderly######################
#Q1: Sitting Activity Frequency in Past 7 days
track.FU2$PASE_Q1<-NA
track.FU2$PASE_Q1[track.FU2$PA2_SIT_TRF2==1]<-0
track.FU2$PASE_Q1[track.FU2$PA2_SIT_TRF2==2]<-0.11
track.FU2$PASE_Q1[track.FU2$PA2_SIT_TRF2==3]<-0.25
track.FU2$PASE_Q1[track.FU2$PA2_SIT_TRF2==4]<-0.43
track.FU2$PASE_Q1[track.FU2$PA2_SIT_TRF2>4]<-NA
track.FU2$PASE_Q1[is.na(track.FU2$PA2_SIT_TRF2)]<-NA

track.FU2$PASE_Q1B<-NA
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2==1]<-0
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2==2]<-1
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2==3]<-3
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2==4]<-6
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2==5]<-10
track.FU2$PASE_Q1B[track.FU2$PA2_SITHR_SIT_TRF2>5]<- 0
track.FU2$PASE_Q1B[is.na(track.FU2$PA2_SITHR_SIT_TRF2)]<-NA
track.FU2$PASE_Q1B<-as.numeric(track.FU2$PASE_Q1B)

#Q2: Walking outside frequency
track.FU2$PASE_Q2<- NULL
track.FU2$PASE_Q2[track.FU2$PA2_WALK_TRF2==1]<-0
track.FU2$PASE_Q2[track.FU2$PA2_WALK_TRF2==2]<-0.11
track.FU2$PASE_Q2[track.FU2$PA2_WALK_TRF2==3]<-0.25
track.FU2$PASE_Q2[track.FU2$PA2_WALK_TRF2==4]<-0.43
track.FU2$PASE_Q2[track.FU2$PA2_WALK_TRF2>4]<-NA
track.FU2$PASE_Q2[is.na(track.FU2$PA2_WALK_TRF2)]<-NA

track.FU2$PASE_Q2A<- NA
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2==1]<-0
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2==2]<-1
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2==3]<-3
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2==4]<-6
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2==5]<-10
track.FU2$PASE_Q2A[track.FU2$PA2_WALKHR_TRF2>5]<-NA
track.FU2$PASE_Q2A[is.na(track.FU2$PA2_WALKHR_TRF2)]<-NA
track.FU2$PASE_Q2A<-as.numeric(track.FU2$PASE_Q2A)

#Q3: Light Sports or Activity Frequency
track.FU2$PASE_Q3<- NA
track.FU2$PASE_Q3[track.FU2$PA2_LSPRT_TRF2==1]<-0
track.FU2$PASE_Q3[track.FU2$PA2_LSPRT_TRF2==2]<-0.11
track.FU2$PASE_Q3[track.FU2$PA2_LSPRT_TRF2==3]<-0.25
track.FU2$PASE_Q3[track.FU2$PA2_LSPRT_TRF2==4]<-0.43
track.FU2$PASE_Q3[track.FU2$PA2_LSPRT_TRF2>4]<-NA
track.FU2$PASE_Q3[is.na(track.FU2$PA2_LSPRT_TRF2)]<-NA

track.FU2$PASE_Q3A<- NA
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2==1]<-0
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2==2]<-1
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2==3]<-3
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2==4]<-6
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2==5]<-10
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2>5]<-NA
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2 == 1 | is.na(track.FU2$PA2_LSPRTHR_TRF2)]<-0
track.FU2$PASE_Q3A[is.na(track.FU2$PA2_LSPRTHR_TRF2) & is.na(track.FU2$PA2_LSPRTHR_TRF2)]<-NA
track.FU2$PASE_Q3A[track.FU2$PA2_LSPRTHR_TRF2>4 & is.na(track.FU2$PA2_LSPRTHR_TRF2)]<-NA
track.FU2$PASE_3A<-as.numeric(track.FU2$PASE_Q3A)

#Q4: Moderate Sports or Activity Frequency
track.FU2$PASE_Q4<-NA
track.FU2$PASE_Q4[track.FU2$PA2_MSPRT_TRF2==1]<-0
track.FU2$PASE_Q4[track.FU2$PA2_MSPRT_TRF2==2]<-0.11
track.FU2$PASE_Q4[track.FU2$PA2_MSPRT_TRF2==3]<-0.25
track.FU2$PASE_Q4[track.FU2$PA2_MSPRT_TRF2==4]<-0.43
track.FU2$PASE_Q4[track.FU2$PA2_MSPRT_TRF2>4]<-NA
track.FU2$PASE_Q4[is.na(track.FU2$PA2_MSPRT_TRF2)]<-NA

track.FU2$PASE_Q4A<- NA
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2==1]<-0
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2==2]<-1
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2==3]<-3
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2==4]<-6
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2==5]<-10
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRTHR_TRF2>5]<-NA
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRT_TRF2 == 1 | is.na(track.FU2$PA2_MSPRTHR_TRF2)]<-0
track.FU2$PASE_Q4A[is.na(track.FU2$PA2_MSPRT_TRF2) & is.na(track.FU2$PA2_MSPRTHR_TRF2)]<-NA
track.FU2$PASE_Q4A[track.FU2$PA2_MSPRT_TRF2>4 & is.na(track.FU2$PA2_MSPRTHR_TRF2)]<-NA
track.FU2$PASE_Q4A<-as.numeric(track.FU2$PASE_Q4A)

#Q5: Strenuous Sports or Activity Frequency
track.FU2$PASE_Q5<-NA
track.FU2$PASE_Q5[track.FU2$PA2_SSPRT_TRF2==1]<-0
track.FU2$PASE_Q5[track.FU2$PA2_SSPRT_TRF2==2]<-0.11
track.FU2$PASE_Q5[track.FU2$PA2_SSPRT_TRF2==3]<-0.25
track.FU2$PASE_Q5[track.FU2$PA2_SSPRT_TRF2==4]<-0.43
track.FU2$PASE_Q5[track.FU2$PA2_SSPRT_TRF2>4]<-NA
track.FU2$PASE_Q5[is.na(track.FU2$PA2_SSPRT_TRF2)]<-NA

track.FU2$PASE_Q5A<- NA
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2==1]<-0
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2==2]<-1
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2==3]<-3
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2==4]<-6
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2==5]<-10
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRTHR_TRF2>5]<-NA
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRT_TRF2 == 1 | is.na(track.FU2$PA2_SSPRTHR_TRF2)]<-0
track.FU2$PASE_Q5A[is.na(track.FU2$PA2_SSPRT_TRF2) & is.na(track.FU2$PA2_SSPRTHR_TRF2)]<-NA
track.FU2$PASE_Q5A[track.FU2$PA2_SSPRT_TRF2>4 & is.na(track.FU2$PA2_SSPRTHR_TRF2)]<-NA
track.FU2$PASE_Q5A<-as.numeric(track.FU2$PASE_Q5A)

#Q6: Muscle strengthening and endurance exercise
track.FU2$PASE_Q6<-NA
track.FU2$PASE_Q6[track.FU2$PA2_EXER_TRF2==1]<-0
track.FU2$PASE_Q6[track.FU2$PA2_EXER_TRF2==2]<-0.11
track.FU2$PASE_Q6[track.FU2$PA2_EXER_TRF2==3]<-0.25
track.FU2$PASE_Q6[track.FU2$PA2_EXER_TRF2==4]<-0.43
track.FU2$PASE_Q6[track.FU2$PA2_EXER_TRF2>4]<-NA
track.FU2$PASE_Q6[is.na(track.FU2$PA2_EXER_TRF2)]<-NA

track.FU2$PASE_Q6A<- NA
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2==1]<-0
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2==2]<-1
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2==3]<-3
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2==4]<-6
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2==5]<-10
track.FU2$PASE_Q6A[track.FU2$PA2_EXERHR_TRF2>5]<-NA
track.FU2$PASE_Q6A[track.FU2$PA2_EXER_TRF2 == 1 | is.na(track.FU2$PA2_EXERHR_TRF2)]<-0
track.FU2$PASE_Q6A[is.na(track.FU2$PA2_EXER_TRF2) & is.na(track.FU2$PA2_EXERHR_TRF2)]<-NA
track.FU2$PASE_Q6A[track.FU2$PA2_EXER_TRF2>4 & is.na(track.FU2$PA2_EXERHR_TRF2)]<-NA
track.FU2$PASE_Q6A<-as.numeric(track.FU2$PASE_Q6A)

#Q7: Light Housework
track.FU2$PASE_Q7<-NA
track.FU2$PASE_Q7[track.FU2$PA2_LTHSWK_TRF2==1]<-1
track.FU2$PASE_Q7[track.FU2$PA2_LTHSWK_TRF2==2]<-0
track.FU2$PASE_Q7[track.FU2$PA2_LTHSWK_TRF2>2]<-NA
track.FU2$PASE_Q7[is.na(track.FU2$PA2_LTHSWK_TRF2)]<-NA
track.FU2$PASE_Q7<-as.numeric(track.FU2$PASE_Q7)

#Q8: Heavy Housework
track.FU2$PASE_Q8<-NA
track.FU2$PASE_Q8[track.FU2$PA2_HVYHSWK_TRF2==1]<-1
track.FU2$PASE_Q8[track.FU2$PA2_HVYHSWK_TRF2==2]<-0
track.FU2$PASE_Q8[track.FU2$PA2_HVYHSWK_TRF2>2]<-NA
track.FU2$PASE_Q8[is.na(track.FU2$PA2_HVYHSWK_TRF2)]<-NA
track.FU2$PASE_Q8<-as.numeric(track.FU2$PASE_Q8)

#Q9: Home Repair, Yardwork, Gardening, Care for another person
track.FU2$PASE_Q9A<-NA
track.FU2$PASE_Q9A[track.FU2$PA2_HMREPAIR_TRF2==1]<-1
track.FU2$PASE_Q9A[track.FU2$PA2_HMREPAIR_TRF2==2]<-0
track.FU2$PASE_Q9A[track.FU2$PA2_HMREPAIR_TRF2>2]<-NA
track.FU2$PASE_Q9A[is.na(track.FU2$PA2_HMREPAIR_TRF2)]<-NA
track.FU2$PASE_Q9A<-as.numeric(track.FU2$PASE_Q9A)

track.FU2$PASE_Q9B<-NA
track.FU2$PASE_Q9B[track.FU2$PA2_HVYODA_TRF2==1]<-1
track.FU2$PASE_Q9B[track.FU2$PA2_HVYODA_TRF2==2]<-0
track.FU2$PASE_Q9B[track.FU2$PA2_HVYODA_TRF2>2]<-NA
track.FU2$PASE_Q9B[is.na(track.FU2$PA2_HVYODA_TRF2)]<-NA
track.FU2$PASE_Q9B<-as.numeric(track.FU2$PASE_Q9B)

track.FU2$PASE_Q9C<-NA
track.FU2$PASE_Q9C[track.FU2$PA2_LTODA_TRF2==1]<-1
track.FU2$PASE_Q9C[track.FU2$PA2_LTODA_TRF2==2]<-0
track.FU2$PASE_Q9C[track.FU2$PA2_LTODA_TRF2>2]<-NA
track.FU2$PASE_Q9C[is.na(track.FU2$PA2_LTODA_TRF2)]<-NA
track.FU2$PASE_Q9C<-as.numeric(track.FU2$PASE_Q9C)

track.FU2$PASE_Q9D<-NA
track.FU2$PASE_Q9D[track.FU2$PA2_CRPRSN_TRF2==1]<-1
track.FU2$PASE_Q9D[track.FU2$PA2_CRPRSN_TRF2==2]<-0
track.FU2$PASE_Q9D[track.FU2$PA2_CRPRSN_TRF2>2]<-NA
track.FU2$PASE_Q9D[is.na(track.FU2$PA2_CRPRSN_TRF2)]<-NA
track.FU2$PASE_Q9D<-as.numeric(track.FU2$PASE_Q9D)

#Q10: Working and Volunteering
track.FU2$PASE_Q10<-NA
track.FU2$PASE_Q10[track.FU2$PA2_WRK_TRF2==1]<-1
track.FU2$PASE_Q10[track.FU2$PA2_WRK_TRF2==2]<-0
track.FU2$PASE_Q10[track.FU2$PA2_WRK_TRF2>2]<-NA
track.FU2$PASE_Q10[is.na(track.FU2$PA2_WRK_TRF2)]<-NA
track.FU2$PASE_Q10<-as.numeric(track.FU2$PASE_Q10)

track.FU2$PASE_Q10A<-NA
track.FU2$PASE_Q10A<-track.FU2$PA2_WRKHRS_NB_TRF2
track.FU2$PASE_Q10A[track.FU2$PA2_WRKHRS_NB_TRF2>=700]<-NA
track.FU2$PASE_Q10A[track.FU2$PA2_WRK_TRF2 == 2 | is.na(track.FU2$PA2_WRKHRS_NB_TRF2)]<-0
track.FU2$PASE_Q10A[is.na(track.FU2$PA2_WRK_TRF2) & is.na(track.FU2$PA2_WRKHRS_NB_TRF2)]<-NA
track.FU2$PASE_Q10A<-as.numeric(track.FU2$PASE_Q10A)
track.FU2$PASE_Q10A<-track.FU2$PASE_Q10A/7

#PASE TOTAL SCORE#
track.FU2$PASE_TOTAL<-track.FU2$PASE_Q2*track.FU2$PASE_Q2A*20 + track.FU2$PASE_Q3*track.FU2$PASE_Q3A*21 +  track.FU2$PASE_Q4*track.FU2$PASE_Q4A*23 + track.FU2$PASE_Q5*track.FU2$PASE_Q5A*30 +
  track.FU2$PASE_Q6*track.FU2$PASE_Q6A*30 + (track.FU2$PASE_Q7+track.FU2$PASE_Q8)*25 + track.FU2$PASE_Q9A*30 + track.FU2$PASE_Q9B*36 + track.FU2$PASE_Q9C*20 + track.FU2$PASE_Q9D*35 + 
  track.FU2$PASE_Q10*track.FU2$PASE_Q10A*21


#BMI (Not included)
track.FU2$Height<-NA
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==1]<-36
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==2]<-37
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==3]<-38
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==4]<-39
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==5]<-40
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==6]<-41
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==7]<-42
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==8]<-43
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==9]<-44
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==10]<-45
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==11]<-46
track.FU2$Height[track.FU2$HWT_HGHT3_TRF2==12]<-47
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==1]<-48
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==2]<-49
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==3]<-50
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==4]<-51
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==5]<-52
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==6]<-53
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==7]<-54
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==8]<-55
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==9]<-56
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==10]<-57
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==11]<-58
track.FU2$Height[track.FU2$HWT_HGHT4_TRF2==12]<-59
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==1]<-60
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==2]<-61
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==3]<-62
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==4]<-63
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==5]<-64
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==6]<-65
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==7]<-66
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==8]<-67
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==9]<-68
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==10]<-69
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==11]<-70
track.FU2$Height[track.FU2$HWT_HGHT5_TRF2==12]<-71
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==1]<-72
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==2]<-73
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==3]<-74
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==4]<-75
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==5]<-76
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==6]<-77
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==7]<-78
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==8]<-79
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==9]<-80
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==10]<-81
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==11]<-82
track.FU2$Height[track.FU2$HWT_HGHT6_TRF2==12]<-83
track.FU2$Height<-as.numeric(track.FU2$Height)*0.0254

track.FU2$Weight<-track.FU2$HWT_WGHT_NB_TRF2
track.FU2$Weight[track.FU2$HWT_WGHT_NB_TRF2>500]<-NA
track.FU2$Weight[track.FU2$HWT_WGHT_NB_TRF2==-8888]<-NA

track.FU2$BMI<-track.FU2$Weight/((track.FU2$Height)^2)

#CESD-10 (NO CESD variable in the data set; need to calculate by hand)
#Q1: I was bothered by things that usually don’t bother me.
track.FU2$CESD_Q1<-NA
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2==1]<-3
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2==2]<-2
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2==3]<-1
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2==4]<-0
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2>4]<-NA
track.FU2$CESD_Q1[track.FU2$DEP_BOTR_TRF2<0]<-NA

#Q2: I had trouble keeping my mind on what I was doing.
track.FU2$CESD_Q2<-NA
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2==1]<-3
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2==2]<-2
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2==3]<-1
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2==4]<-0
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2>4]<-NA
track.FU2$CESD_Q2[track.FU2$DEP_MIND_TRF2<0]<-NA

#Q3: I felt depressed
track.FU2$CESD_Q3<-NA
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2==1]<-3
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2==2]<-2
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2==3]<-1
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2==4]<-0
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2>4]<-NA
track.FU2$CESD_Q3[track.FU2$DEP_FLDP_TRF2<0]<-NA

#Q4: I felt that everything I did was an effort.
track.FU2$CESD_Q4<-NA
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2==1]<-3
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2==2]<-2
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2==3]<-1
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2==4]<-0
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2>4]<-NA
track.FU2$CESD_Q4[track.FU2$DEP_FFRT_TRF2<0]<-NA

#Q5: I felt hopeful about the future
track.FU2$CESD_Q5<-NA
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2==1]<-0
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2==2]<-1
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2==3]<-2
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2==4]<-3
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2>4]<-NA
track.FU2$CESD_Q5[track.FU2$DEP_HPFL_TRF2<0]<-NA

#Q6: I felt fearful.
track.FU2$CESD_Q6<-NA
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2==1]<-3
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2==2]<-2
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2==3]<-1
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2==4]<-0
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2>4]<-NA
track.FU2$CESD_Q6[track.FU2$DEP_FRFL_TRF2<0]<-NA

#Q7: My sleep was restless
track.FU2$CESD_Q7<-NA
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2==1]<-3
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2==2]<-2
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2==3]<-1
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2==4]<-0
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2>4]<-NA
track.FU2$CESD_Q7[track.FU2$DEP_RSTLS_TRF2<0]<-NA

#Q8: I was happy
track.FU2$CESD_Q8<-NA
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2==1]<-0
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2==2]<-1
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2==3]<-2
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2==4]<-3
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2>4]<-NA
track.FU2$CESD_Q8[track.FU2$DEP_HAPP_TRF2<0]<-NA

#Q9: I felt lonely
track.FU2$CESD_Q9<-NA
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2==1]<-3
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2==2]<-2
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2==3]<-1
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2==4]<-0
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2>4]<-NA
track.FU2$CESD_Q9[track.FU2$DEP_LONLY_TRF2<0]<-NA

#Q10: I could not “get going.”
track.FU2$CESD_Q10<-NA
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2==1]<-3
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2==2]<-2
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2==3]<-1
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2==4]<-0
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2>4]<-NA
track.FU2$CESD_Q10[track.FU2$DEP_GTGO_TRF2<0]<-NA

track.FU2$CESD_10<-track.FU2$CESD_Q1 + track.FU2$CESD_Q2 + track.FU2$CESD_Q3 + track.FU2$CESD_Q4 + track.FU2$CESD_Q5 + 
  track.FU2$CESD_Q6 + track.FU2$CESD_Q7 + track.FU2$CESD_Q8 + track.FU2$CESD_Q9 + track.FU2$CESD_Q10

#Subjective Cognitive Impairment
track.FU2$SCI<- NA
track.FU2$SCI[track.FU2$CCT_MEMPB_TRF2==1]<- "Yes"
track.FU2$SCI[track.FU2$CCT_MEMPB_TRF2==2]<- "No"

#Dementia and AD
track.FU2$Dementia<- NA
track.FU2$Dementia[track.FU2$CCT_ALZH_TRF2==1]<- "Yes"
track.FU2$Dementia[track.FU2$CCT_ALZH_TRF2==2]<- "No"

#Anxiety
track.FU2$Anxiety<- NA
track.FU2$Anxiety[track.FU2$CCT_ANXI_TRF2==1]<- "Yes"
track.FU2$Anxiety[track.FU2$CCT_ANXI_TRF2==2]<- "No"

#Mood Disorders
track.FU2$Mood_Disord<- NA
track.FU2$Mood_Disord[track.FU2$CCT_MOOD_TRF2==1]<- "Yes"
track.FU2$Mood_Disord[track.FU2$CCT_MOOD_TRF2==2]<- "No"

#Number of Chronic Conditions
track.FU2$Chronic_conditions<-NA

#Pet Ownership at Baseline
track.FU2$Pet_Owner<-NA
track.FU2$Pet_Owner[track.FU2$SSA_PET_TRF2==1]<-"Yes"
track.FU2$Pet_Owner[track.FU2$SSA_PET_TRF2==2]<-"No"


track.FU2$CCT_HEART_TRM[track.FU2$CCT_HEART_TRF2==1]<- 1 #Heart Disease
track.FU2$CCT_HEART_TRM[track.FU2$CCT_HEART_TRF2==2]<- 0
track.FU2$CCT_HEART_TRM[track.FU2$CCT_HEART_TRF2==8]<- NA
track.FU2$CCT_HEART_TRM[track.FU2$CCT_HEART_TRF2==9]<- NA

track.FU2$CCT_PVD_TRM[track.FU2$CCT_PAD_TRF2==1]<- 1 #peripheral vascular disease (called Peripheral Artery Disease, unlike Baseline or FU1)
track.FU2$CCT_PVD_TRM[track.FU2$CCT_PAD_TRF2==2]<- 0
track.FU2$CCT_PVD_TRM[track.FU2$CCT_PAD_TRF2==8]<- NA
track.FU2$CCT_PVD_TRM[track.FU2$CCT_PAD_TRF2==9]<- NA

track.FU2$CCT_MEMPB_TRM[track.FU2$CCT_MEMPB_TRF2==1]<- 1 #SCI
track.FU2$CCT_MEMPB_TRM[track.FU2$CCT_MEMPB_TRF2==2]<- 0
track.FU2$CCT_MEMPB_TRM[track.FU2$CCT_MEMPB_TRF2==8]<- NA
track.FU2$CCT_MEMPB_TRM[track.FU2$CCT_MEMPB_TRF2==9]<- NA

track.FU2$CCT_ALZH_TRM[track.FU2$CCT_ALZH_TRF2==1]<- 1 #Alzheimers or demeinta
track.FU2$CCT_ALZH_TRM[track.FU2$CCT_ALZH_TRF2==2]<- 0
track.FU2$CCT_ALZH_TRM[track.FU2$CCT_ALZH_TRF2==8]<- NA
track.FU2$CCT_ALZH_TRM[track.FU2$CCT_ALZH_TRF2==9]<- NA

track.FU2$CCT_MS_TRM[track.FU2$CCT_MS_TRF2==1]<- 1 #Multiple sclerosis
track.FU2$CCT_MS_TRM[track.FU2$CCT_MS_TRF2==2]<- 0
track.FU2$CCT_MS_TRM[track.FU2$CCT_MS_TRF2==8]<- NA
track.FU2$CCT_MS_TRM[track.FU2$CCT_MS_TRF2==9]<- NA

track.FU2$CCT_EPIL_TRM[track.FU2$EPI_EVER_TRF2==1]<- 1 #Epilepsy (Different question)
track.FU2$CCT_EPIL_TRM[track.FU2$EPI_EVER_TRF2==2]<- 0
track.FU2$CCT_EPIL_TRM[track.FU2$EPI_EVER_TRF2==3]<- NA
track.FU2$CCT_EPIL_TRM[track.FU2$EPI_EVER_TRF2==8]<- NA
track.FU2$CCT_EPIL_TRM[track.FU2$EPI_EVER_TRF2==9]<- NA

track.FU2$CCT_MGRN_TRM[track.FU2$CCT_MGRN_TRF2==1]<- 1 #Migraine headaches
track.FU2$CCT_MGRN_TRM[track.FU2$CCT_MGRN_TRF2==2]<- 0
track.FU2$CCT_MGRN_TRM[track.FU2$CCT_MGRN_TRF2==8]<- NA
track.FU2$CCT_MGRN_TRM[track.FU2$CCT_MGRN_TRF2==9]<- NA

track.FU2$CCT_ULCR_TRM[track.FU2$CCT_ULCR_TRF2==1]<- 1 #Intenstinal or stomach ulcers
track.FU2$CCT_ULCR_TRM[track.FU2$CCT_ULCR_TRF2==2]<- 0
track.FU2$CCT_ULCR_TRM[track.FU2$CCT_ULCR_TRF2==8]<- NA
track.FU2$CCT_ULCR_TRM[track.FU2$CCT_ULCR_TRF2==9]<- NA

track.FU2$CCT_IBDIBS_TRM[track.FU2$CCT_IBSYD_TRF2==1]<- 1 #Bowel disorder (different name for IBS and IBD)
track.FU2$CCT_IBDIBS_TRM[track.FU2$CCT_IBSYD_TRF2==2]<- 0
track.FU2$CCT_IBDIBS_TRM[track.FU2$CCT_IBSYD_TRF2==8]<- NA
track.FU2$CCT_IBDIBS_TRM[track.FU2$CCT_IBSYD_TRF2==9]<- NA

track.FU2$CCT_BOWINC_TRM[track.FU2$CCT_BOWINC_TRF2==1]<- 1 #Bowel incontinence
track.FU2$CCT_BOWINC_TRM[track.FU2$CCT_BOWINC_TRF2==2]<- 0
track.FU2$CCT_BOWINC_TRM[track.FU2$CCT_BOWINC_TRF2==8]<- NA
track.FU2$CCT_BOWINC_TRM[track.FU2$CCT_BOWINC_TRF2==9]<- NA

track.FU2$CCT_URIINC_TRM[track.FU2$CCT_URIINC_TRF2==1]<- 1 #Urinary incontinence
track.FU2$CCT_URIINC_TRM[track.FU2$CCT_URIINC_TRF2==2]<- 0
track.FU2$CCT_URIINC_TRM[track.FU2$CCT_URIINC_TRF2==8]<- NA
track.FU2$CCT_URIINC_TRM[track.FU2$CCT_URIINC_TRF2==9]<- NA

track.FU2$CCT_MACDEG_TRM[track.FU2$CCT_MACDEG_TRF2==1]<- 1 #Macular degeneration
track.FU2$CCT_MACDEG_TRM[track.FU2$CCT_MACDEG_TRF2==2]<- 0
track.FU2$CCT_MACDEG_TRM[track.FU2$CCT_MACDEG_TRF2==8]<- NA
track.FU2$CCT_MACDEG_TRM[track.FU2$CCT_MACDEG_TRF2==9]<- NA

track.FU2$CCT_CANC_TRM[track.FU2$CCT_CANC_TRF2==1]<- 1 #All-cause cancer
track.FU2$CCT_CANC_TRM[track.FU2$CCT_CANC_TRF2==2]<- 0
track.FU2$CCT_CANC_TRM[track.FU2$CCT_CANC_TRF2==8]<- NA
track.FU2$CCT_CANC_TRM[track.FU2$CCT_CANC_TRF2==9]<- NA

track.FU2$CCT_BCKP_TRM<-NA #Back problems but not fibromyalgia or arthritis (Question not included)

track.FU2$CCT_KIDN_TRM[track.FU2$CCT_KIDN_TRF2==1]<- 1 #Kidney disease
track.FU2$CCT_KIDN_TRM[track.FU2$CCT_KIDN_TRF2==2]<- 0
track.FU2$CCT_KIDN_TRM[track.FU2$CCT_KIDN_TRF2==8]<- NA
track.FU2$CCT_KIDN_TRM[track.FU2$CCT_KIDN_TRF2==9]<- NA

track.FU2$CCT_OTCCT_TRM <- NA #Other long term mental or physical condition (Question not included)

track.FU2$CCT_OAHAND_TRM[track.FU2$CCT_OAHAND_TRF2==1]<- 1 #Hand arthritis
track.FU2$CCT_OAHAND_TRM[track.FU2$CCT_OAHAND_TRF2==2]<- 0
track.FU2$CCT_OAHAND_TRM[track.FU2$CCT_OAHAND_TRF2==8]<- NA
track.FU2$CCT_OAHAND_TRM[track.FU2$CCT_OAHAND_TRF2==9]<- NA

track.FU2$CCT_OAHIP_TRM[track.FU2$CCT_OAHIP_TRF2==1]<- 1 #Hip arthritis
track.FU2$CCT_OAHIP_TRM[track.FU2$CCT_OAHIP_TRF2==2]<- 0
track.FU2$CCT_OAHIP_TRM[track.FU2$CCT_OAHIP_TRF2==8]<- NA
track.FU2$CCT_OAHIP_TRM[track.FU2$CCT_OAHIP_TRF2==9]<- NA

track.FU2$CCT_OAKNEE_TRM[track.FU2$CCT_OAKNEE_TRF2==1]<- 1 #Knee arthritis
track.FU2$CCT_OAKNEE_TRM[track.FU2$CCT_OAKNEE_TRF2==2]<- 0
track.FU2$CCT_OAKNEE_TRM[track.FU2$CCT_OAKNEE_TRF2==8]<- NA
track.FU2$CCT_OAKNEE_TRM[track.FU2$CCT_OAKNEE_TRF2==9]<- NA

track.FU2$CCT_RA_TRM[track.FU2$CCT_RA_TRF2==1]<- 1 #Rheumatoid arthritis
track.FU2$CCT_RA_TRM[track.FU2$CCT_RA_TRF2==2]<- 0
track.FU2$CCT_RA_TRM[track.FU2$CCT_RA_TRF2==8]<- NA
track.FU2$CCT_RA_TRM[track.FU2$CCT_RA_TRF2==9]<- NA

track.FU2$CCT_ARTOT_TRM <- NA #Other arthritis (not included in the data)

track.FU2$DIA_DIAB_TRM[track.FU2$CCT_DIAB_TRF2==1]<- 1 #Diabetes
track.FU2$DIA_DIAB_TRM[track.FU2$CCT_DIAB_TRF2==2]<- 0
track.FU2$DIA_DIAB_TRM[track.FU2$CCT_DIAB_TRF2==8]<- NA
track.FU2$DIA_DIAB_TRM[track.FU2$CCT_DIAB_TRF2==9]<- NA

track.FU2$CCT_HBP_TRM[track.FU2$CCT_HBP_TRF2==1]<- 1 #High blood pressure
track.FU2$CCT_HBP_TRM[track.FU2$CCT_HBP_TRF2==2]<- 0
track.FU2$CCT_HBP_TRM[track.FU2$CCT_HBP_TRF2==8]<- NA
track.FU2$CCT_HBP_TRM[track.FU2$CCT_HBP_TRF2==9]<- NA

track.FU2$CCT_UTHYR_TRM[track.FU2$CCT_UTHYR_TRF2==1]<- 1 #Under active thyroid
track.FU2$CCT_UTHYR_TRM[track.FU2$CCT_UTHYR_TRF2==2]<- 0
track.FU2$CCT_UTHYR_TRM[track.FU2$CCT_UTHYR_TRF2==8]<- NA
track.FU2$CCT_UTHYR_TRM[track.FU2$CCT_UTHYR_TRF2==9]<- NA

track.FU2$CCT_ANGI_TRM[track.FU2$CCT_ANGI_TRF2==1]<- 1 #Angina
track.FU2$CCT_ANGI_TRM[track.FU2$CCT_ANGI_TRF2==2]<- 0
track.FU2$CCT_ANGI_TRM[track.FU2$CCT_ANGI_TRF2==8]<- NA
track.FU2$CCT_ANGI_TRM[track.FU2$CCT_ANGI_TRF2==9]<- NA

track.FU2$CCT_CVA_TRM[track.FU2$CCT_CVA_TRF2==1]<- 1 #Stroke or CVA
track.FU2$CCT_CVA_TRM[track.FU2$CCT_CVA_TRF2==2]<- 0
track.FU2$CCT_CVA_TRM[track.FU2$CCT_CVA_TRF2==8]<- NA
track.FU2$CCT_CVA_TRM[track.FU2$CCT_CVA_TRF2==9]<- NA

track.FU2$CCT_AMI_TRM[track.FU2$CCT_AMI_TRF2==1]<- 1 #myocardial infarction
track.FU2$CCT_AMI_TRM[track.FU2$CCT_AMI_TRF2==2]<- 0
track.FU2$CCT_AMI_TRM[track.FU2$CCT_AMI_TRF2==8]<- NA
track.FU2$CCT_AMI_TRM[track.FU2$CCT_AMI_TRF2==9]<- NA

track.FU2$CCT_OTHYR_TRM[track.FU2$CCT_OTHYR_TRF2==1]<- 1 #Overactive thyroid
track.FU2$CCT_OTHYR_TRM[track.FU2$CCT_OTHYR_TRF2==2]<- 0
track.FU2$CCT_OTHYR_TRM[track.FU2$CCT_OTHYR_TRF2==8]<- NA
track.FU2$CCT_OTHYR_TRM[track.FU2$CCT_OTHYR_TRF2==9]<- NA

track.FU2$CCT_TIA_TRM[track.FU2$CCT_TIA_TRF2==1]<- 1 #Transient Ischemic Attack
track.FU2$CCT_TIA_TRM[track.FU2$CCT_TIA_TRF2==2]<- 0
track.FU2$CCT_TIA_TRM[track.FU2$CCT_TIA_TRF2==8]<- NA
track.FU2$CCT_TIA_TRM[track.FU2$CCT_TIA_TRF2==9]<- NA

track.FU2$CCT_ASTHM_TRM[track.FU2$CCT_ASTHM_TRF2==1]<- 1 #Asthma
track.FU2$CCT_ASTHM_TRM[track.FU2$CCT_ASTHM_TRF2==2]<- 0
track.FU2$CCT_ASTHM_TRM[track.FU2$CCT_ASTHM_TRF2==8]<- NA
track.FU2$CCT_ASTHM_TRM[track.FU2$CCT_ASTHM_TRF2==9]<- NA

track.FU2$CCT_OSTPO_TRM[track.FU2$CCT_OSTPO_TRF2==1]<- 1 #Osteoperosis
track.FU2$CCT_OSTPO_TRM[track.FU2$CCT_OSTPO_TRF2==2]<- 0
track.FU2$CCT_OSTPO_TRM[track.FU2$CCT_OSTPO_TRF2==8]<- NA
track.FU2$CCT_OSTPO_TRM[track.FU2$CCT_OSTPO_TRF2==9]<- NA

track.FU2$CCT_PARK_TRM[track.FU2$PKD_PARK_TRF2==1]<- 1 #Parkinsons
track.FU2$CCT_PARK_TRM[track.FU2$PKD_PARK_TRF2==2]<- 0
track.FU2$CCT_PARK_TRM[track.FU2$PKD_PARK_TRF2==8]<- NA
track.FU2$CCT_PARK_TRM[track.FU2$PKD_PARK_TRF2==9]<- NA

track.FU2$CCT_COPD_TRM[track.FU2$CCT_COPD_TRF2==1]<- 1 #COPD
track.FU2$CCT_COPD_TRM[track.FU2$CCT_COPD_TRF2==2]<- 0
track.FU2$CCT_COPD_TRM[track.FU2$CCT_COPD_TRF2==8]<- NA
track.FU2$CCT_COPD_TRM[track.FU2$CCT_COPD_TRF2==9]<- NA

track.FU2$Chronic_conditions<-track.FU2$CCT_HEART_TRM + track.FU2$CCT_PVD_TRM + track.FU2$CCT_MEMPB_TRM + track.FU2$CCT_ALZH_TRM + track.FU2$CCT_MS_TRM + 
  track.FU2$CCT_EPIL_TRM + track.FU2$CCT_MGRN_TRM + track.FU2$CCT_ULCR_TRM +
  track.FU2$CCT_IBDIBS_TRM + track.FU2$CCT_BOWINC_TRM + track.FU2$CCT_URIINC_TRM + track.FU2$CCT_MACDEG_TRM + track.FU2$CCT_CANC_TRM + track.FU2$CCT_KIDN_TRM + 
  track.FU2$CCT_OAHAND_TRM + track.FU2$CCT_OAHIP_TRM + track.FU2$CCT_OAKNEE_TRM + track.FU2$CCT_RA_TRM  +
  track.FU2$DIA_DIAB_TRM + track.FU2$CCT_HBP_TRM + track.FU2$CCT_UTHYR_TRM + track.FU2$CCT_ANGI_TRM + track.FU2$CCT_CVA_TRM + track.FU2$CCT_AMI_TRM + track.FU2$CCT_OTHYR_TRM + 
  track.FU2$CCT_TIA_TRM + track.FU2$CCT_ASTHM_TRM + track.FU2$CCT_OSTPO_TRM + track.FU2$CCT_PARK_TRM + track.FU2$CCT_COPD_TRM

track.FU2.1<-track.FU2[c(1:3,78:86,108,111,122:128)]

names(track.FU2.1) <-paste(names(track.FU2.1),"_2", sep="")

track.FU2.Final<- rename(track.FU2.1, "ID" = "entity_id_2")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#FU2 (Cogs)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
setwd("~/Desktop/UBC-Postdoctoral Fellowship/CLSA - COVID Brain/Data/23SP001_McMaster_PRaina_FUP2_COG")

trackFU2cogs<-read.csv("23SP001_McMaster_PRaina_Cognition_Tra_FUP2_v0.csv")#Comprehensive Cohort Baseline

track.FU2cogs<-trackFU2cogs[c(1,64:66,110,109,41,42,48,47)]

############Cognitive Function##############

#~~~~~~Animal Fluency~~~~~~~~~~~#
track.FU2cogs$Animal_Fluency_Strict<-track.FU2cogs$COG_AFT_SCORE_1_TRF2
track.FU2cogs$Animal_Fluency_Lenient<-track.FU2cogs$COG_AFT_SCORE_2_TRF2
track.FU2cogs$Animal_Fluency_Lenient[track.FU2cogs$Animal_Fluency_Lenient<0]<-NA
track.FU2cogs$Animal_Fluency_Strict[track.FU2cogs$Animal_Fluency_Strict<0]<-NA

track.FU2cogs$Animal_Fluency_Lang<-NA
track.FU2cogs$Animal_Fluency_Lang[track.FU2cogs$COG_AFT_STARTLANG_TRF2=="en"]<-"English"
track.FU2cogs$Animal_Fluency_Lang[track.FU2cogs$COG_AFT_STARTLANG_TRF2=="fr"]<-"French"

#~~~~~~~~Mental Alteration Test~~~~~~~~~~#
track.FU2cogs$MAT_Lang<-NA
track.FU2cogs$MAT_Lang[track.FU2cogs$COG_MAT_STARTLANG_TRF2=="en"]<-"English"
track.FU2cogs$MAT_Lang[track.FU2cogs$COG_MAT_STARTLANG_TRF2=="fr"]<-"French"

track.FU2cogs$MAT_Score<-track.FU2cogs$COG_MAT_SCORE_TRF2

track.FU2cogs$MAT_Score[track.FU2cogs$MAT_Score<0]<-NA


#~~~~~~~~RVLT~~~~~~~~~~~~~~~~#
#Rey-Immediate Recall
track.FU2cogs$RVLT_Immediate_Lang<- NA
track.FU2cogs$RVLT_Immediate_Lang[track.FU2cogs$COG_REYI_STARTLANG_TRF2=="en"]<-"English"
track.FU2cogs$RVLT_Immediate_Lang[track.FU2cogs$COG_REYI_STARTLANG_TRF2=="fr"]<-"French"

track.FU2cogs$RVLT_Immediate_Score<-track.FU2cogs$COG_REYI_SCORE_TRF2

track.FU2cogs$RVLT_Immediate_Score[track.FU2cogs$RVLT_Immediate_Score<0]<-NA

#Rey-Delayed Recall
track.FU2cogs$RVLT_Delayed_Lang<- NA
track.FU2cogs$RVLT_Delayed_Lang[track.FU2cogs$COG_REYII_STARTLANG_TRF2=="en"]<-"English"
track.FU2cogs$RVLT_Delayed_Lang[track.FU2cogs$COG_REYII_STARTLANG_TRF2=="fr"]<-"French"

track.FU2cogs$RVLT_Delayed_Score<-track.FU2cogs$COG_REYII_SCORE_TRF2

track.FU2cogs$RVLT_Delayed_Score[track.FU2cogs$RVLT_Delayed_Score<0]<-NA

track.FU2cogs1 <- track.FU2cogs[c(1,11:19)]

names(track.FU2cogs1) <-paste(names(track.FU2cogs1),"_2", sep="")

track.FU2cogs.Final<- rename(track.FU2cogs1, "ID" = "entity_id_2")

1.3) Data merging

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Combine Datasets
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Combine Baseline dataframes
Track.Baseline.Final <- merge(track.BL.Final, track.BLcogs.Final, by = "ID")

#Combine FU1 dataframes
Track.FU1.Final <- merge(track.FU1.Final, track.FU1cogs.Final, by = "ID")

#Combine FU2 dataframes
Track.FU2.Final <- merge(track.FU2.Final, track.FU2cogs.Final, by = "ID")

#Combine data across different time points into full data set
Track.BL.FU1 <- merge(Track.Baseline.Final, Track.FU1.Final, by = "ID")

Track.Full <- merge(Track.BL.FU1, Track.FU2.Final, by = "ID")

2) Flow-chart for participants

Full tracking cohort at baseline (N=21,241)

Track.Baseline.total <- Track.Baseline.Final %>%
  count()
print(Track.Baseline.total)
##       n
## 1 21241

Excluding tracking cohort participants lost to follow-up (N=14,697)

Track.Complete <- Track.Full %>%
  count()
print(Track.Complete)
##       n
## 1 14697

Baseline tracking cohort removing individuals who reported SCI or dementia at baseline, FU1, or FU2 (N=13,934)

Track.SCI_Dementia <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2) %>%
  count()
print(Track.SCI_Dementia)
## # A tibble: 40 × 7
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2 [40]
##    SCI_0 Dementia_0 SCI_1 Dementia_1 SCI_2 Dementia_2     n
##    <chr> <chr>      <chr> <chr>      <chr> <chr>      <int>
##  1 No    No         No    No         No    No         13934
##  2 No    No         No    No         No    Yes            7
##  3 No    No         No    No         No    <NA>           7
##  4 No    No         No    No         Yes   No           143
##  5 No    No         No    No         Yes   Yes           18
##  6 No    No         No    No         Yes   <NA>           2
##  7 No    No         No    No         <NA>  No            15
##  8 No    No         No    No         <NA>  Yes            1
##  9 No    No         No    No         <NA>  <NA>         160
## 10 No    No         No    Yes        No    <NA>           3
## # … with 30 more rows

Baseline comprehensive cohort removing individuals with dementia or SCI and without full cog data (N=11,383)

Track.FullCogs <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, 
           !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0)) %>%
  count()
print(Track.FullCogs)
## # A tibble: 105 × 11
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0) [105]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   FALSE   TRUE   
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    TRUE   
##  5 No    No         No    No       No    No      FALSE   TRUE    FALSE   FALSE  
##  6 No    No         No    No       No    No      FALSE   TRUE    FALSE   TRUE   
##  7 No    No         No    No       No    No      FALSE   TRUE    TRUE    FALSE  
##  8 No    No         No    No       No    No      FALSE   TRUE    TRUE    TRUE   
##  9 No    No         No    No       No    No      TRUE    FALSE   FALSE   FALSE  
## 10 No    No         No    No       No    No      TRUE    FALSE   FALSE   TRUE   
## # … with 95 more rows, 1 more variable: n <int>, and abbreviated variable names
## #   ¹​Dementia_1, ²​Dementia_2, ³​`!is.na(MAT_Score_0)`,
## #   ⁴​`!is.na(RVLT_Immediate_Score_0)`, ⁵​`!is.na(RVLT_Delayed_Score_0)`,
## #   ⁶​`!is.na(Animal_Fluency_Strict_0)`

Baseline comprehensive cohort removing individuals with dementia or SCI and without full cog data or PASE data (N=9,181)

Track.PASleep <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
           !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0), !is.na(PASE_TOTAL_0)) %>%
  count()
print(Track.PASleep)
## # A tibble: 162 × 13
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0),
## #   !is.na(PASE_TOTAL_0) [162]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  5 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  6 No    No         No    No       No    No      FALSE   FALSE   TRUE    TRUE   
##  7 No    No         No    No       No    No      FALSE   FALSE   TRUE    TRUE   
##  8 No    No         No    No       No    No      FALSE   FALSE   TRUE    TRUE   
##  9 No    No         No    No       No    No      FALSE   FALSE   TRUE    TRUE   
## 10 No    No         No    No       No    No      FALSE   TRUE    FALSE   FALSE  
## # … with 152 more rows, 3 more variables:
## #   `!is.na(Animal_Fluency_Strict_0)` <lgl>, `!is.na(PASE_TOTAL_0)` <lgl>,
## #   n <int>, and abbreviated variable names ¹​Dementia_1, ²​Dementia_2,
## #   ³​`!is.na(MAT_Score_0)`, ⁴​`!is.na(RVLT_Immediate_Score_0)`,
## #   ⁵​`!is.na(Education4_0)`, ⁶​`!is.na(RVLT_Delayed_Score_0)`

Final Baseline data set (N=18,308) and excluding people without full cog data at FU1, PASE score(N=1,945)

Track.PA_1 <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
           !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0), !is.na(PASE_TOTAL_0),
           !is.na(MAT_Score_1), !is.na(RVLT_Immediate_Score_1), 
           !is.na(RVLT_Delayed_Score_1),!is.na(Animal_Fluency_Strict_1), !is.na(PASE_TOTAL_1)) %>%
  count()
print(Track.PA_1)
## # A tibble: 416 × 18
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0),
## #   !is.na(PASE_TOTAL_0), !is.na(MAT_Score_1), !is.na(RVLT_Immediate_Score_1),
## #   !is.na(RVLT_Delayed_Score_1), !is.na(Animal_Fluency_Strict_1),
## #   !is.na(PASE_TOTAL_1) [416]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  5 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  6 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  7 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  8 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  9 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## 10 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## # … with 406 more rows, 8 more variables:
## #   `!is.na(Animal_Fluency_Strict_0)` <lgl>, `!is.na(PASE_TOTAL_0)` <lgl>,
## #   `!is.na(MAT_Score_1)` <lgl>, `!is.na(RVLT_Immediate_Score_1)` <lgl>,
## #   `!is.na(RVLT_Delayed_Score_1)` <lgl>,
## #   `!is.na(Animal_Fluency_Strict_1)` <lgl>, `!is.na(PASE_TOTAL_1)` <lgl>,
## #   n <int>, and abbreviated variable names ¹​Dementia_1, ²​Dementia_2,
## #   ³​`!is.na(MAT_Score_0)`, ⁴​`!is.na(RVLT_Immediate_Score_0)`, …

Final Baseline data set (N=11,383) and excluding people without full cog data at FU1 (N=11,355)

Track.Cogs_1 <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0), 
           !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0),
           !is.na(MAT_Score_1), !is.na(RVLT_Immediate_Score_1), 
           !is.na(RVLT_Delayed_Score_1),!is.na(Animal_Fluency_Strict_1)) %>%
  count()
print(Track.Cogs_1)
## # A tibble: 234 × 16
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0),
## #   !is.na(MAT_Score_1), !is.na(RVLT_Immediate_Score_1),
## #   !is.na(RVLT_Delayed_Score_1), !is.na(Animal_Fluency_Strict_1) [234]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  5 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  6 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  7 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  8 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  9 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## 10 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## # … with 224 more rows, 6 more variables:
## #   `!is.na(Animal_Fluency_Strict_0)` <lgl>, `!is.na(MAT_Score_1)` <lgl>,
## #   `!is.na(RVLT_Immediate_Score_1)` <lgl>,
## #   `!is.na(RVLT_Delayed_Score_1)` <lgl>,
## #   `!is.na(Animal_Fluency_Strict_1)` <lgl>, n <int>, and abbreviated variable
## #   names ¹​Dementia_1, ²​Dementia_2, ³​`!is.na(MAT_Score_0)`,
## #   ⁴​`!is.na(RVLT_Immediate_Score_0)`, ⁵​`!is.na(Education4_0)`, …

Final Baseline data set (N=11,383) and excluding people without full cog data at FU2 (N=8,118)

Track.Cogs_2 <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
           !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0), !is.na(PASE_TOTAL_0),
           !is.na(MAT_Score_2), !is.na(RVLT_Immediate_Score_2), 
           !is.na(RVLT_Delayed_Score_2),!is.na(Animal_Fluency_Strict_2)) %>%
  count()
print(Track.Cogs_2)
## # A tibble: 340 × 17
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0),
## #   !is.na(PASE_TOTAL_0), !is.na(MAT_Score_2), !is.na(RVLT_Immediate_Score_2),
## #   !is.na(RVLT_Delayed_Score_2), !is.na(Animal_Fluency_Strict_2) [340]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  5 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  6 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  7 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  8 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  9 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## 10 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## # … with 330 more rows, 7 more variables:
## #   `!is.na(Animal_Fluency_Strict_0)` <lgl>, `!is.na(PASE_TOTAL_0)` <lgl>,
## #   `!is.na(MAT_Score_2)` <lgl>, `!is.na(RVLT_Immediate_Score_2)` <lgl>,
## #   `!is.na(RVLT_Delayed_Score_2)` <lgl>,
## #   `!is.na(Animal_Fluency_Strict_2)` <lgl>, n <int>, and abbreviated variable
## #   names ¹​Dementia_1, ²​Dementia_2, ³​`!is.na(MAT_Score_0)`,
## #   ⁴​`!is.na(RVLT_Immediate_Score_0)`, ⁵​`!is.na(Education4_0)`, …

Final Baseline data set (N=11,383) removing individuals without full cog data or PASE data at FU2 (N=1,931)

Track.PASleep_2 <- Track.Full %>%
  group_by(SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2, !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
           !is.na(RVLT_Delayed_Score_0),!is.na(Animal_Fluency_Strict_0), !is.na(PASE_TOTAL_0),
           !is.na(MAT_Score_2), !is.na(RVLT_Immediate_Score_2), 
           !is.na(RVLT_Delayed_Score_2),!is.na(Animal_Fluency_Strict_2), !is.na(PASE_TOTAL_2)) %>%
  count()
print(Track.PASleep_2)
## # A tibble: 435 × 18
## # Groups:   SCI_0, Dementia_0, SCI_1, Dementia_1, SCI_2, Dementia_2,
## #   !is.na(MAT_Score_0), !is.na(RVLT_Immediate_Score_0), !is.na(Education4_0),
## #   !is.na(RVLT_Delayed_Score_0), !is.na(Animal_Fluency_Strict_0),
## #   !is.na(PASE_TOTAL_0), !is.na(MAT_Score_2), !is.na(RVLT_Immediate_Score_2),
## #   !is.na(RVLT_Delayed_Score_2), !is.na(Animal_Fluency_Strict_2),
## #   !is.na(PASE_TOTAL_2) [435]
##    SCI_0 Dementia_0 SCI_1 Dement…¹ SCI_2 Demen…² !is.n…³ !is.n…⁴ !is.n…⁵ !is.n…⁶
##    <chr> <chr>      <chr> <chr>    <chr> <chr>   <lgl>   <lgl>   <lgl>   <lgl>  
##  1 No    No         No    No       No    No      FALSE   FALSE   FALSE   FALSE  
##  2 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  3 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  4 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  5 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  6 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  7 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  8 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
##  9 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## 10 No    No         No    No       No    No      FALSE   FALSE   TRUE    FALSE  
## # … with 425 more rows, 8 more variables:
## #   `!is.na(Animal_Fluency_Strict_0)` <lgl>, `!is.na(PASE_TOTAL_0)` <lgl>,
## #   `!is.na(MAT_Score_2)` <lgl>, `!is.na(RVLT_Immediate_Score_2)` <lgl>,
## #   `!is.na(RVLT_Delayed_Score_2)` <lgl>,
## #   `!is.na(Animal_Fluency_Strict_2)` <lgl>, `!is.na(PASE_TOTAL_2)` <lgl>,
## #   n <int>, and abbreviated variable names ¹​Dementia_1, ²​Dementia_2,
## #   ³​`!is.na(MAT_Score_0)`, ⁴​`!is.na(RVLT_Immediate_Score_0)`, …

2.1) Final data-set development

This section details how our final data-set was developed. Our final data set included cognitively healthy participants at baseline, FU1, and FU2 with complete baseline neuropsycholoigcal testing (including education level, which was necessary for standardized scores). Thus our final sample size included in our linear mixed models was N=11,355.

Track.Final_Data <- subset(Track.Full, SCI_0=="No" & Dementia_0=="No" & SCI_1=="No" & Dementia_1 =="No" & 
                       SCI_2=="No" & Dementia_2 == "No" & !is.na(Animal_Fluency_Strict_0) & !is.na(MAT_Score_0) & !is.na(Education4_0) &
                       !is.na(RVLT_Immediate_Score_0) & !is.na(RVLT_Delayed_Score_0))

We then normalized all cognitive variables for language, age, and biological sex. Score standardization is dependent upon the following steps:

  1. Create a predicted score based on age, sex, and test language
  2. Create residualized score (i.e., obtained - predicted)
  3. Develop a standardized residual score adjusted for age, sex, and education
  4. Develop standardized z-score adjusted for age, sex, and education
  5. Develop standardized score using z-score with a mean of 10 and a SD of 3.
Tracking.Adjusted_Full <- Track.Final_Data %>%
  mutate(
    #Baseline Scores
    
    #RVLT Immediate Score
    RVLT_Immediate_Predicted_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ 7.768 - 0.050*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ 7.449 - 0.036*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="English" ~ 10.095 - 0.073*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="English" ~ 9.686 - 0.064*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ 8.077 - 0.043*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ 9.806 - 0.059*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="English" ~ 9.161 - 0.047*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="English" ~ 9.804 - 0.053*Age_0,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ 5.666 - 0.025*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ 8.953 - 0.067*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="French" ~ 7.662 - 0.039*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="French" ~ 8.829 - 0.057*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ 6.976 - 0.031*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ 8.667 - 0.045*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="French" ~ 9.502 - 0.061*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="French" ~ 9.013 - 0.047*Age_0
    ),
    RVLT_Immediate_Residual_0 = RVLT_Immediate_Score_0 - RVLT_Immediate_Predicted_0,
    RVLT_Immediate_Z_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.471,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.525,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.611,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.675,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.528,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.643,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.694,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="English" ~ RVLT_Immediate_Residual_0/1.802,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.290,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.473,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.913,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.641,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.623,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.595,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.605,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Immediate_Lang_0=="French" ~ RVLT_Immediate_Residual_0/1.715
    ),
    RVLT_Immediate_Normed_0 = RVLT_Immediate_Z_0*3 +10,
    RVLT_Immediate_Normed_0 = if_else(RVLT_Immediate_Normed_0 < 0, 0.01, RVLT_Immediate_Normed_0),
    
    #RVLT Delayed Score
    RVLT_Delayed_Predicted_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ 6.628 - 0.062*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ 6.851 - 0.058*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="English" ~ 8.289 - 0.076*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="English" ~ 8.165 - 0.070*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ 7.163 - 0.055*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ 8.115 - 0.063*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="English" ~ 8.151 - 0.059*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="English" ~ 8.844 - 0.066*Age_0,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ 4.802 - 0.036*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ 8.219 - 0.083*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="French" ~ 9.721 - 0.097*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="French" ~ 7.048 - 0.055*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ 6.280 - 0.044*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ 6.999 - 0.042*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="French" ~ 9.081 - 0.074*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="French" ~ 8.712 - 0.066*Age_0
    ),
    RVLT_Delayed_Residual_0 = RVLT_Delayed_Score_0 - RVLT_Delayed_Predicted_0,
    RVLT_Delayed_Z_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.534,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.739,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.802,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.890,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.787,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/2.005,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/1.869,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="English" ~ RVLT_Delayed_Residual_0/2.135,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.559,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.571,
      Sex_0 =="M" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.815,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.721,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.859,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.793,
      Sex_0 =="F" & Education4_0 == "Some College" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.901,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & RVLT_Delayed_Lang_0=="French" ~ RVLT_Delayed_Residual_0/1.890
    ),
    RVLT_Delayed_Normed_0 = RVLT_Delayed_Z_0*3 +10,
    RVLT_Delayed_Normed_0 = if_else(RVLT_Delayed_Normed_0 < 0, 0.01, RVLT_Delayed_Normed_0),
    
    #Animal Fluency
    Animal_Fluency_Predicted_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="English" ~ 23.132 - 0.095*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="English" ~ 28.923 - 0.157*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="English" ~ 32.513 - 0.202*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="English" ~ 31.143 - 0.168*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="English" ~ 23.433 - 0.114*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="English" ~ 29.912 - 0.181*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="English" ~ 30.764 - 0.178*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="English" ~ 32.003 - 0.186*Age_0,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="French" ~ 26.034 - 0.152*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="French" ~ 33.358 - 0.241*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="French" ~ 36.511 - 0.277*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="French" ~ 30.193 - 0.179*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="French" ~ 21.460 - 0.089*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="French" ~ 21.355 - 0.070*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="French" ~ 30.881 - 0.205*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="French" ~ 29.961 - 0.180*Age_0
    ),
    Animal_Fluency_Residual_0 = Animal_Fluency_Strict_0 - Animal_Fluency_Predicted_0,
    Animal_Fluency_Z_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.145,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.348,
      Sex_0 =="M" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.163,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.354,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/4.665,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/4.728,
      Sex_0 =="F" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.176,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="English" ~ Animal_Fluency_Residual_0/5.369,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/3.911,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.889,
      Sex_0 =="M" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/5.061,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.869,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.178,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.321,
      Sex_0 =="F" & Education4_0 == "Some College" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.468,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & Animal_Fluency_Lang_0=="French" ~ Animal_Fluency_Residual_0/4.940
    ),
    Animal_Fluency_Normed_0 = Animal_Fluency_Z_0*3 +10,
    Animal_Fluency_Normed_0 = if_else(Animal_Fluency_Normed_0 < 0, 0.01, Animal_Fluency_Normed_0),
    
    #Mental Alteration Test    
    MAT_Predicted_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="English" ~ 33.295 - 0.161*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & MAT_Lang_0=="English" ~ 34.074 - 0.123*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & MAT_Lang_0=="English" ~ 41.488 - 0.219*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="English" ~ 40.573 - 0.190*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="English" ~ 39.102 - 0.251*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & MAT_Lang_0=="English" ~ 41.657 - 0.246*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & MAT_Lang_0=="English" ~ 36.877 - 0.168*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="English" ~ 38.849 - 0.188*Age_0,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="French" ~ 36.630 - 0.252*Age_0,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & MAT_Lang_0=="French" ~ 38.784 - 0.181*Age_0,
      Sex_0 =="M" & Education4_0 == "Some College" & MAT_Lang_0=="French" ~ 51.105 - 0.381*Age_0,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="French" ~ 44.106 - 0.257*Age_0,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="French" ~ 34.814 - 0.214*Age_0,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & MAT_Lang_0=="French" ~ 38.756 - 0.202*Age_0,
      Sex_0 =="F" & Education4_0 == "Some College" & MAT_Lang_0=="French" ~ 47.024 - 0.315*Age_0,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="French" ~ 41.717 - 0.234*Age_0
    ),
    MAT_Residual_0 = MAT_Score_0 - MAT_Predicted_0,
    MAT_Z_0 = case_when(
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.602,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.702,
      Sex_0 =="M" & Education4_0 == "Some College" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.490,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.727,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.080,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & MAT_Lang_0=="English" ~ MAT_Residual_0/7.139,
      Sex_0 =="F" & Education4_0 == "Some College" & MAT_Lang_0=="English" ~ MAT_Residual_0/6.915,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="English" ~ MAT_Residual_0/6.979,
      Sex_0 =="M" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="French" ~ MAT_Residual_0/7.589,
      Sex_0 =="M" & Education4_0 == "High School Diploma" & MAT_Lang_0=="French" ~ MAT_Residual_0/7.234,
      Sex_0 =="M" & Education4_0 == "Some College" & MAT_Lang_0=="French" ~ MAT_Residual_0/6.314,
      Sex_0 =="M" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="French" ~ MAT_Residual_0/7.609,
      Sex_0 =="F" & Education4_0 == "Less than High School Diploma" & MAT_Lang_0=="French" ~ MAT_Residual_0/6.803,
      Sex_0 =="F" & Education4_0 == "High School Diploma" & MAT_Lang_0=="French" ~ MAT_Residual_0/7.079,
      Sex_0 =="F" & Education4_0 == "Some College" & MAT_Lang_0=="French" ~ MAT_Residual_0/6.451,
      Sex_0 =="F" & Education4_0 == "College Degree or Higher" & MAT_Lang_0=="French" ~ MAT_Residual_0/6.734
    ),
    MAT_Normed_0 = MAT_Z_0*3 +10,
    MAT_Normed_0 = if_else(MAT_Normed_0 < 0, 0.01, MAT_Normed_0),
    
    #Global Cognition Composite Score
    Global_Composite_0 = RVLT_Immediate_Z_0 + RVLT_Delayed_Z_0 + Animal_Fluency_Z_0 + MAT_Z_0,
    
    #FU1 Scores
    
    #RVLT Immediate Score
    RVLT_Immediate_Predicted_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ 7.768 - 0.050*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ 7.449 - 0.036*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="English" ~ 10.095 - 0.073*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="English" ~ 9.686 - 0.064*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ 8.077 - 0.043*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ 9.806 - 0.059*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="English" ~ 9.161 - 0.047*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="English" ~ 9.804 - 0.053*Age_1,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ 5.666 - 0.025*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ 8.953 - 0.067*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="French" ~ 7.662 - 0.039*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="French" ~ 8.829 - 0.057*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ 6.976 - 0.031*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ 8.667 - 0.045*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="French" ~ 9.502 - 0.061*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="French" ~ 9.013 - 0.047*Age_1
    ),
    RVLT_Immediate_Residual_1 = RVLT_Immediate_Score_1 - RVLT_Immediate_Predicted_1,
    RVLT_Immediate_Z_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.471,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.525,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.611,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.675,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.528,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.643,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.694,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="English" ~ RVLT_Immediate_Residual_1/1.802,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.290,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.473,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.913,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.641,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.623,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.595,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.605,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Immediate_Lang_1=="French" ~ RVLT_Immediate_Residual_1/1.715
    ),
    RVLT_Immediate_Normed_1 = RVLT_Immediate_Z_1*3 + 10,
    RVLT_Immediate_Normed_1 = if_else(RVLT_Immediate_Normed_1 < 0, 0.01, RVLT_Immediate_Normed_1),
    
    
    #RVLT Delayed Score
    RVLT_Delayed_Predicted_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ 6.628 - 0.062*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ 6.851 - 0.058*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="English" ~ 8.289 - 0.076*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="English" ~ 8.165 - 0.070*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ 7.163 - 0.055*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ 8.115 - 0.063*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="English" ~ 8.151 - 0.059*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="English" ~ 8.844 - 0.066*Age_1,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ 4.802 - 0.036*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ 8.219 - 0.083*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="French" ~ 9.721 - 0.097*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="French" ~ 7.048 - 0.055*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ 6.280 - 0.044*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ 6.999 - 0.042*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="French" ~ 9.081 - 0.074*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="French" ~ 8.712 - 0.066*Age_1
    ),
    RVLT_Delayed_Residual_1 = RVLT_Delayed_Score_1 - RVLT_Delayed_Predicted_1,
    RVLT_Delayed_Z_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.534,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.739,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.802,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.890,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.787,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/2.005,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/1.869,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="English" ~ RVLT_Delayed_Residual_1/2.135,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.559,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.571,
      Sex_1 =="M" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.815,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.721,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.859,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.793,
      Sex_1 =="F" & Education4_1 == "Some College" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.901,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & RVLT_Delayed_Lang_1=="French" ~ RVLT_Delayed_Residual_1/1.890
    ),
    RVLT_Delayed_Normed_1 = RVLT_Delayed_Z_1*3 + 10,
    RVLT_Delayed_Normed_1 = if_else(RVLT_Delayed_Normed_1 < 0, 0.01, RVLT_Delayed_Normed_1),
    
    #Animal Fluency
    Animal_Fluency_Predicted_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="English" ~ 23.132 - 0.095*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="English" ~ 28.923 - 0.157*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="English" ~ 32.513 - 0.202*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="English" ~ 31.143 - 0.168*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="English" ~ 23.433 - 0.114*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="English" ~ 29.912 - 0.181*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="English" ~ 30.764 - 0.178*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="English" ~ 32.003 - 0.186*Age_1,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="French" ~ 26.034 - 0.152*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="French" ~ 33.358 - 0.241*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="French" ~ 36.511 - 0.277*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="French" ~ 30.193 - 0.179*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="French" ~ 21.460 - 0.089*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="French" ~ 21.355 - 0.070*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="French" ~ 30.881 - 0.205*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="French" ~ 29.961 - 0.180*Age_1
    ),
    Animal_Fluency_Residual_1 = Animal_Fluency_Strict_1 - Animal_Fluency_Predicted_1,
    Animal_Fluency_Z_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.145,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.348,
      Sex_1 =="M" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.163,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.354,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/4.665,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/4.728,
      Sex_1 =="F" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.176,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="English" ~ Animal_Fluency_Residual_1/5.369,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/3.911,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.889,
      Sex_1 =="M" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/5.061,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.869,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.178,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.321,
      Sex_1 =="F" & Education4_1 == "Some College" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.468,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & Animal_Fluency_Lang_1=="French" ~ Animal_Fluency_Residual_1/4.940
    ),
    Animal_Fluency_Normed_1 = Animal_Fluency_Z_1*3 + 10,
    Animal_Fluency_Normed_1 = if_else(Animal_Fluency_Normed_1 < 0, 0.01, Animal_Fluency_Normed_1),
    
    #Mental Alteration Test
    MAT_Predicted_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="English" ~ 33.295 - 0.161*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & MAT_Lang_1=="English" ~ 34.074 - 0.123*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & MAT_Lang_1=="English" ~ 41.488 - 0.219*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="English" ~ 40.573 - 0.190*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="English" ~ 39.102 - 0.251*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & MAT_Lang_1=="English" ~ 41.657 - 0.246*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & MAT_Lang_1=="English" ~ 36.877 - 0.168*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="English" ~ 38.849 - 0.188*Age_1,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="French" ~ 36.630 - 0.252*Age_1,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & MAT_Lang_1=="French" ~ 38.784 - 0.181*Age_1,
      Sex_1 =="M" & Education4_1 == "Some College" & MAT_Lang_1=="French" ~ 51.105 - 0.381*Age_1,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="French" ~ 44.106 - 0.257*Age_1,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="French" ~ 34.814 - 0.214*Age_1,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & MAT_Lang_1=="French" ~ 38.756 - 0.202*Age_1,
      Sex_1 =="F" & Education4_1 == "Some College" & MAT_Lang_1=="French" ~ 47.024 - 0.315*Age_1,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="French" ~ 41.717 - 0.234*Age_1
    ),
    MAT_Residual_1 = MAT_Score_1 - MAT_Predicted_1,
    MAT_Z_1 = case_when(
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.602,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.702,
      Sex_1 =="M" & Education4_1 == "Some College" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.490,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.727,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.080,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & MAT_Lang_1=="English" ~ MAT_Residual_1/7.139,
      Sex_1 =="F" & Education4_1 == "Some College" & MAT_Lang_1=="English" ~ MAT_Residual_1/6.915,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="English" ~ MAT_Residual_1/6.979,
      Sex_1 =="M" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="French" ~ MAT_Residual_1/7.589,
      Sex_1 =="M" & Education4_1 == "High School Diploma" & MAT_Lang_1=="French" ~ MAT_Residual_1/7.234,
      Sex_1 =="M" & Education4_1 == "Some College" & MAT_Lang_1=="French" ~ MAT_Residual_1/6.314,
      Sex_1 =="M" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="French" ~ MAT_Residual_1/7.609,
      Sex_1 =="F" & Education4_1 == "Less than High School Diploma" & MAT_Lang_1=="French" ~ MAT_Residual_1/6.803,
      Sex_1 =="F" & Education4_1 == "High School Diploma" & MAT_Lang_1=="French" ~ MAT_Predicted_1/7.079,
      Sex_1 =="F" & Education4_1 == "Some College" & MAT_Lang_1=="French" ~ MAT_Predicted_1/6.451,
      Sex_1 =="F" & Education4_1 == "College Degree or Higher" & MAT_Lang_1=="French" ~ MAT_Predicted_1/6.734
    ),
    MAT_Normed_1 = MAT_Z_1*3 + 10,
    MAT_Normed_1 = if_else(MAT_Normed_1 < 0, 0.01, MAT_Normed_1),
    
    #Global Cognition Composite Score
    Global_Composite_1 = RVLT_Immediate_Z_1 + RVLT_Delayed_Z_1 + Animal_Fluency_Z_1 + MAT_Z_1,
    
    
    #FU2 Scores
    
    #RVLT Immediate Score
    RVLT_Immediate_Predicted_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ 7.768 - 0.050*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ 7.449 - 0.036*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="English" ~ 10.095 - 0.073*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="English" ~ 9.686 - 0.064*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ 8.077 - 0.043*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ 9.806 - 0.059*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="English" ~ 9.161 - 0.047*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="English" ~ 9.804 - 0.053*Age_2,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ 5.666 - 0.025*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ 8.953 - 0.067*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="French" ~ 7.662 - 0.039*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="French" ~ 8.829 - 0.057*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ 6.976 - 0.031*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ 8.667 - 0.045*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="French" ~ 9.502 - 0.061*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="French" ~ 9.013 - 0.047*Age_2
    ),
    RVLT_Immediate_Residual_2 = RVLT_Immediate_Score_2 - RVLT_Immediate_Predicted_2,
    RVLT_Immediate_Z_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.471,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.525,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.611,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.675,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.528,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.643,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.694,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="English" ~ RVLT_Immediate_Residual_2/1.802,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.290,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.473,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.913,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.641,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.623,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.595,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.605,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Immediate_Lang_2=="French" ~ RVLT_Immediate_Residual_2/1.715
    ),
    RVLT_Immediate_Normed_2 = RVLT_Immediate_Z_2*3 + 10,
    RVLT_Immediate_Normed_2 = if_else(RVLT_Immediate_Normed_2 < 0, 0.01, RVLT_Immediate_Normed_2),
    
    #RVLT Delayed Score
    RVLT_Delayed_Predicted_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ 6.628 - 0.062*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ 6.851 - 0.058*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="English" ~ 8.289 - 0.076*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="English" ~ 8.165 - 0.070*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ 7.163 - 0.055*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ 8.115 - 0.063*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="English" ~ 8.151 - 0.059*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="English" ~ 8.844 - 0.066*Age_2,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ 4.802 - 0.036*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ 8.219 - 0.083*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="French" ~ 9.721 - 0.097*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="French" ~ 7.048 - 0.055*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ 6.280 - 0.044*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ 6.999 - 0.042*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="French" ~ 9.081 - 0.074*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="French" ~ 8.712 - 0.066*Age_2
    ),
    RVLT_Delayed_Residual_2 = RVLT_Delayed_Score_2 - RVLT_Delayed_Predicted_2,
    RVLT_Delayed_Z_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.534,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.739,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.802,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.890,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.787,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/2.005,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/1.869,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="English" ~ RVLT_Delayed_Residual_2/2.135,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.559,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.571,
      Sex_2 =="M" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.815,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.721,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.859,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.793,
      Sex_2 =="F" & Education4_2 == "Some College" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.901,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & RVLT_Delayed_Lang_2=="French" ~ RVLT_Delayed_Residual_2/1.890
    ),
    RVLT_Delayed_Normed_2 = RVLT_Delayed_Z_2*3 + 10,
    RVLT_Delayed_Normed_2 = if_else(RVLT_Delayed_Normed_2 < 0, 0.01, RVLT_Delayed_Normed_2),
    
    #Animal Fluency
    Animal_Fluency_Predicted_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="English" ~ 23.132 - 0.095*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="English" ~ 28.923 - 0.157*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="English" ~ 32.513 - 0.202*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="English" ~ 31.143 - 0.168*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="English" ~ 23.433 - 0.114*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="English" ~ 29.912 - 0.181*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="English" ~ 30.764 - 0.178*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="English" ~ 32.003 - 0.186*Age_2,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="French" ~ 26.034 - 0.152*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="French" ~ 33.358 - 0.241*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="French" ~ 36.511 - 0.277*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="French" ~ 30.193 - 0.179*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="French" ~ 21.460 - 0.089*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="French" ~ 21.355 - 0.070*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="French" ~ 30.881 - 0.205*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="French" ~ 29.961 - 0.180*Age_2
    ),
    Animal_Fluency_Residual_2 = Animal_Fluency_Strict_2 - Animal_Fluency_Predicted_2,
    Animal_Fluency_Z_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.145,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.348,
      Sex_2 =="M" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.163,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.354,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/4.665,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/4.728,
      Sex_2 =="F" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.176,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="English" ~ Animal_Fluency_Residual_2/5.369,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/3.911,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.889,
      Sex_2 =="M" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/5.061,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.869,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.178,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.321,
      Sex_2 =="F" & Education4_2 == "Some College" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.468,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & Animal_Fluency_Lang_2=="French" ~ Animal_Fluency_Residual_2/4.940
    ),
    Animal_Fluency_Normed_2 = Animal_Fluency_Z_2*3 + 10,
    Animal_Fluency_Normed_2 = if_else(Animal_Fluency_Normed_2 < 0, 0.01, Animal_Fluency_Normed_2),
    
    #Mental Alteration Test
    MAT_Predicted_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="English" ~ 33.295 - 0.161*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & MAT_Lang_2=="English" ~ 34.074 - 0.123*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & MAT_Lang_2=="English" ~ 41.488 - 0.219*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="English" ~ 40.573 - 0.190*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="English" ~ 39.102 - 0.251*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & MAT_Lang_2=="English" ~ 41.657 - 0.246*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & MAT_Lang_2=="English" ~ 36.877 - 0.168*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="English" ~ 38.849 - 0.188*Age_2,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="French" ~ 36.630 - 0.252*Age_2,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & MAT_Lang_2=="French" ~ 38.784 - 0.181*Age_2,
      Sex_2 =="M" & Education4_2 == "Some College" & MAT_Lang_2=="French" ~ 51.105 - 0.381*Age_2,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="French" ~ 44.106 - 0.257*Age_2,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="French" ~ 34.814 - 0.214*Age_2,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & MAT_Lang_2=="French" ~ 38.756 - 0.202*Age_2,
      Sex_2 =="F" & Education4_2 == "Some College" & MAT_Lang_2=="French" ~ 47.024 - 0.315*Age_2,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="French" ~ 41.717 - 0.234*Age_2
    ),
    MAT_Residual_2 = MAT_Score_2 - MAT_Predicted_2,
    MAT_Z_2 = case_when(
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.602,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.702,
      Sex_2 =="M" & Education4_2 == "Some College" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.490,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.727,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.080,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & MAT_Lang_2=="English" ~ MAT_Residual_2/7.139,
      Sex_2 =="F" & Education4_2 == "Some College" & MAT_Lang_2=="English" ~ MAT_Residual_2/6.915,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="English" ~ MAT_Residual_2/6.979,
      Sex_2 =="M" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="French" ~ MAT_Residual_2/7.589,
      Sex_2 =="M" & Education4_2 == "High School Diploma" & MAT_Lang_2=="French" ~ MAT_Residual_2/7.234,
      Sex_2 =="M" & Education4_2 == "Some College" & MAT_Lang_2=="French" ~ MAT_Residual_2/6.314,
      Sex_2 =="M" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="French" ~ MAT_Residual_2/7.609,
      Sex_2 =="F" & Education4_2 == "Less than High School Diploma" & MAT_Lang_2=="French" ~ MAT_Residual_2/6.803,
      Sex_2 =="F" & Education4_2 == "High School Diploma" & MAT_Lang_2=="French" ~ MAT_Residual_2/7.079,
      Sex_2 =="F" & Education4_2 == "Some College" & MAT_Lang_2=="French" ~ MAT_Residual_2/6.451,
      Sex_2 =="F" & Education4_2 == "College Degree or Higher" & MAT_Lang_2=="French" ~ MAT_Residual_2/6.734
    ),
    MAT_Normed_2 = MAT_Z_2*3 + 10,
    MAT_Normed_2 = if_else(MAT_Normed_2 < 0, 0.01, MAT_Normed_2),
    
    #Global Cognition Composite Score
    Global_Composite_2 = RVLT_Immediate_Z_2 + RVLT_Delayed_Z_2 + Animal_Fluency_Z_0 + MAT_Z_2
  )

Finally, we categorized participants as having their follow-up 2 data collected before or after the start of the COVID-19 pandemic.

Tracking.Adjusted_Final <- Tracking.Adjusted_Full %>%
  mutate(timestamp = ymd_hms(startdate_TRF2_2, tz = "EST"))
## Date in ISO8601 format; converting timezone from UTC to "EST".
start_time <- as.POSIXct("2020-03-11 00:00:00", tz = "EST")
Tracking.Adjusted_Final$Pandemic<-NA
Tracking.Adjusted_Final$Pandemic[Tracking.Adjusted_Final$timestamp>=start_time]<-"FU2 data collected after COVID-19"
Tracking.Adjusted_Final$Pandemic[Tracking.Adjusted_Final$timestamp<start_time]<-"FU2 data collected before COVID-19"

3) Participant characteristics at baseline

Final baseline sample (N= 11,355)

Baseline<-dput(names(Tracking.Adjusted_Final[c(5,4,14,12,6,7,8,9,10,11,15,18,19,20,13,28,30,26,23)]))
## c("Age_0", "Sex_0", "BMI_0", "Ethnicity_0", "Relationship_status_0", 
## "Education4_0", "Income_Level_0", "Living_status_0", "Alcohol_0", 
## "Smoking_Status_0", "CESD_10_0", "Anxiety_0", "Mood_Disord_0", 
## "Pet_Owner_0", "PASE_TOTAL_0", "RVLT_Immediate_Score_0", "RVLT_Delayed_Score_0", 
## "MAT_Score_0", "Animal_Fluency_Strict_0")
Table1_Final<-CreateTableOne(vars=Baseline, data=Tracking.Adjusted_Final)
print(Table1_Final,contDigits=2,missing=TRUE,quote=TRUE)
##                                               ""
##  ""                                            "Overall"        "Missing"
##   "n"                                          " 11355"         "    "   
##   "Age_0 (mean (SD))"                          " 61.62 (10.08)" " 0.0"   
##   "Sex_0 = M (%)"                              "  5467 (48.1) " " 0.0"   
##   "BMI_0 (mean (SD))"                          " 27.50 (5.10)"  " 0.5"   
##   "Ethnicity_0 = White (%)"                    " 11043 (97.3) " " 0.0"   
##   "Relationship_status_0 (%)"                  " "              " 0.0"   
##   "   Divorced"                                "   997 ( 8.8) " "    "   
##   "   Married"                                 "  8210 (72.3) " "    "   
##   "   Separated"                               "   290 ( 2.6) " "    "   
##   "   Single"                                  "   852 ( 7.5) " "    "   
##   "   Widowed"                                 "  1001 ( 8.8) " "    "   
##   "Education4_0 (%)"                           " "              " 0.0"   
##   "   College Degree or Higher"                "  8322 (73.3) " "    "   
##   "   High School Diploma"                     "  1449 (12.8) " "    "   
##   "   Less than High School Diploma"           "   749 ( 6.6) " "    "   
##   "   Some College"                            "   835 ( 7.4) " "    "   
##   "Income_Level_0 (%)"                         " "              " 3.5"   
##   "   <$20k"                                   "  1764 (16.1) " "    "   
##   "   >$150k"                                  "   428 ( 3.9) " "    "   
##   "   $100-150k"                               "   836 ( 7.6) " "    "   
##   "   $20-50k"                                 "  4349 (39.7) " "    "   
##   "   $50-100k"                                "  3584 (32.7) " "    "   
##   "Living_status_0 (%)"                        " "              " 0.0"   
##   "   Apartment/Condo/Townhome"                "  1342 (11.8) " "    "   
##   "   Assisted Living"                         "    61 ( 0.5) " "    "   
##   "   House"                                   "  9852 (86.8) " "    "   
##   "   Other"                                   "   100 ( 0.9) " "    "   
##   "Alcohol_0 (%)"                              " "              " 3.1"   
##   "   Non-drinker"                             "  1154 (10.5) " "    "   
##   "   Occasional drinker"                      "  1729 (15.7) " "    "   
##   "   Regular drinker (at least once a month)" "  8124 (73.8) " "    "   
##   "Smoking_Status_0 (%)"                       " "              " 0.4"   
##   "   Daily Smoker"                            "   744 ( 6.6) " "    "   
##   "   Former Smoker"                           "  6830 (60.4) " "    "   
##   "   Never Smoked"                            "  3541 (31.3) " "    "   
##   "   Occasional Smoker"                       "   189 ( 1.7) " "    "   
##   "CESD_10_0 (mean (SD))"                      "  4.96 (4.36)"  " 0.3"   
##   "Anxiety_0 = Yes (%)"                        "   718 ( 6.3) " " 0.1"   
##   "Mood_Disord_0 = Yes (%)"                    "  1508 (13.3) " " 0.1"   
##   "Pet_Owner_0 = Yes (%)"                      "  5357 (47.3) " " 0.4"   
##   "PASE_TOTAL_0 (mean (SD))"                   "168.93 (78.96)" "19.1"   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  6.19 (2.26)"  " 0.0"   
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.61 (2.51)"  " 0.0"   
##   "MAT_Score_0 (mean (SD))"                    " 27.21 (9.10)"  " 0.0"   
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.40 (5.68)"  " 0.0"

Final baseline sample stratified by whether FU2 data was collected before (N= 6,174) or after (N= 5,181) the start of the COVID-19 pandemic

Table1_Final_stratify<-CreateTableOne(vars=Baseline, strata="Pandemic", data=Tracking.Adjusted_Final)
print(Table1_Final_stratify,contDigits=2,missing=TRUE,quote=TRUE)
##                                               "Stratified by Pandemic"
##  ""                                            "FU2 data collected after COVID-19"
##   "n"                                          "  5181"                           
##   "Age_0 (mean (SD))"                          " 60.29 (10.54)"                   
##   "Sex_0 = M (%)"                              "  2856 (55.1) "                   
##   "BMI_0 (mean (SD))"                          " 27.52 (4.94)"                    
##   "Ethnicity_0 = White (%)"                    "  5025 (97.0) "                   
##   "Relationship_status_0 (%)"                  "  "                               
##   "   Divorced"                                "   408 ( 7.9) "                   
##   "   Married"                                 "  3841 (74.2) "                   
##   "   Separated"                               "   150 ( 2.9) "                   
##   "   Single"                                  "   383 ( 7.4) "                   
##   "   Widowed"                                 "   397 ( 7.7) "                   
##   "Education4_0 (%)"                           "  "                               
##   "   College Degree or Higher"                "  3605 (69.6) "                   
##   "   High School Diploma"                     "   776 (15.0) "                   
##   "   Less than High School Diploma"           "   411 ( 7.9) "                   
##   "   Some College"                            "   389 ( 7.5) "                   
##   "Income_Level_0 (%)"                         "  "                               
##   "   <$20k"                                   "   783 (15.6) "                   
##   "   >$150k"                                  "   239 ( 4.8) "                   
##   "   $100-150k"                               "   426 ( 8.5) "                   
##   "   $20-50k"                                 "  1874 (37.3) "                   
##   "   $50-100k"                                "  1700 (33.9) "                   
##   "Living_status_0 (%)"                        "  "                               
##   "   Apartment/Condo/Townhome"                "   579 (11.2) "                   
##   "   Assisted Living"                         "    24 ( 0.5) "                   
##   "   House"                                   "  4541 (87.6) "                   
##   "   Other"                                   "    37 ( 0.7) "                   
##   "Alcohol_0 (%)"                              "  "                               
##   "   Non-drinker"                             "   512 (10.2) "                   
##   "   Occasional drinker"                      "   784 (15.6) "                   
##   "   Regular drinker (at least once a month)" "  3731 (74.2) "                   
##   "Smoking_Status_0 (%)"                       "  "                               
##   "   Daily Smoker"                            "   361 ( 7.0) "                   
##   "   Former Smoker"                           "  3128 (60.6) "                   
##   "   Never Smoked"                            "  1579 (30.6) "                   
##   "   Occasional Smoker"                       "    90 ( 1.7) "                   
##   "CESD_10_0 (mean (SD))"                      "  5.08 (4.47)"                    
##   "Anxiety_0 = Yes (%)"                        "   335 ( 6.5) "                   
##   "Mood_Disord_0 = Yes (%)"                    "   698 (13.5) "                   
##   "Pet_Owner_0 = Yes (%)"                      "  2562 (49.6) "                   
##   "PASE_TOTAL_0 (mean (SD))"                   "179.56 (81.39)"                   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  5.98 (2.20)"                    
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.42 (2.43)"                    
##   "MAT_Score_0 (mean (SD))"                    " 27.11 (9.20)"                    
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.28 (5.74)"                    
##                                               "Stratified by Pandemic"
##  ""                                            "FU2 data collected before COVID-19"
##   "n"                                          "  6174"                            
##   "Age_0 (mean (SD))"                          " 62.74 (9.53)"                     
##   "Sex_0 = M (%)"                              "  2611 (42.3) "                    
##   "BMI_0 (mean (SD))"                          " 27.48 (5.24)"                     
##   "Ethnicity_0 = White (%)"                    "  6018 (97.5) "                    
##   "Relationship_status_0 (%)"                  "  "                                
##   "   Divorced"                                "   589 ( 9.5) "                    
##   "   Married"                                 "  4369 (70.8) "                    
##   "   Separated"                               "   140 ( 2.3) "                    
##   "   Single"                                  "   469 ( 7.6) "                    
##   "   Widowed"                                 "   604 ( 9.8) "                    
##   "Education4_0 (%)"                           "  "                                
##   "   College Degree or Higher"                "  4717 (76.4) "                    
##   "   High School Diploma"                     "   673 (10.9) "                    
##   "   Less than High School Diploma"           "   338 ( 5.5) "                    
##   "   Some College"                            "   446 ( 7.2) "                    
##   "Income_Level_0 (%)"                         "  "                                
##   "   <$20k"                                   "   981 (16.5) "                    
##   "   >$150k"                                  "   189 ( 3.2) "                    
##   "   $100-150k"                               "   410 ( 6.9) "                    
##   "   $20-50k"                                 "  2475 (41.7) "                    
##   "   $50-100k"                                "  1884 (31.7) "                    
##   "Living_status_0 (%)"                        "  "                                
##   "   Apartment/Condo/Townhome"                "   763 (12.4) "                    
##   "   Assisted Living"                         "    37 ( 0.6) "                    
##   "   House"                                   "  5311 (86.0) "                    
##   "   Other"                                   "    63 ( 1.0) "                    
##   "Alcohol_0 (%)"                              "  "                                
##   "   Non-drinker"                             "   642 (10.7) "                    
##   "   Occasional drinker"                      "   945 (15.8) "                    
##   "   Regular drinker (at least once a month)" "  4393 (73.5) "                    
##   "Smoking_Status_0 (%)"                       "  "                                
##   "   Daily Smoker"                            "   383 ( 6.2) "                    
##   "   Former Smoker"                           "  3702 (60.2) "                    
##   "   Never Smoked"                            "  1962 (31.9) "                    
##   "   Occasional Smoker"                       "    99 ( 1.6) "                    
##   "CESD_10_0 (mean (SD))"                      "  4.85 (4.27)"                     
##   "Anxiety_0 = Yes (%)"                        "   383 ( 6.2) "                    
##   "Mood_Disord_0 = Yes (%)"                    "   810 (13.1) "                    
##   "Pet_Owner_0 = Yes (%)"                      "  2795 (45.5) "                    
##   "PASE_TOTAL_0 (mean (SD))"                   "160.16 (75.79)"                    
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  6.37 (2.29)"                     
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.77 (2.55)"                     
##   "MAT_Score_0 (mean (SD))"                    " 27.29 (9.02)"                     
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.51 (5.64)"                     
##                                               "Stratified by Pandemic"
##  ""                                            "p"      "test" "Missing"
##   "n"                                          ""       ""     "    "   
##   "Age_0 (mean (SD))"                          "<0.001" ""     " 0.0"   
##   "Sex_0 = M (%)"                              "<0.001" ""     " 0.0"   
##   "BMI_0 (mean (SD))"                          " 0.688" ""     " 0.5"   
##   "Ethnicity_0 = White (%)"                    " 0.130" ""     " 0.0"   
##   "Relationship_status_0 (%)"                  "<0.001" ""     " 0.0"   
##   "   Divorced"                                ""       ""     "    "   
##   "   Married"                                 ""       ""     "    "   
##   "   Separated"                               ""       ""     "    "   
##   "   Single"                                  ""       ""     "    "   
##   "   Widowed"                                 ""       ""     "    "   
##   "Education4_0 (%)"                           "<0.001" ""     " 0.0"   
##   "   College Degree or Higher"                ""       ""     "    "   
##   "   High School Diploma"                     ""       ""     "    "   
##   "   Less than High School Diploma"           ""       ""     "    "   
##   "   Some College"                            ""       ""     "    "   
##   "Income_Level_0 (%)"                         "<0.001" ""     " 3.5"   
##   "   <$20k"                                   ""       ""     "    "   
##   "   >$150k"                                  ""       ""     "    "   
##   "   $100-150k"                               ""       ""     "    "   
##   "   $20-50k"                                 ""       ""     "    "   
##   "   $50-100k"                                ""       ""     "    "   
##   "Living_status_0 (%)"                        " 0.043" ""     " 0.0"   
##   "   Apartment/Condo/Townhome"                ""       ""     "    "   
##   "   Assisted Living"                         ""       ""     "    "   
##   "   House"                                   ""       ""     "    "   
##   "   Other"                                   ""       ""     "    "   
##   "Alcohol_0 (%)"                              " 0.584" ""     " 3.1"   
##   "   Non-drinker"                             ""       ""     "    "   
##   "   Occasional drinker"                      ""       ""     "    "   
##   "   Regular drinker (at least once a month)" ""       ""     "    "   
##   "Smoking_Status_0 (%)"                       " 0.219" ""     " 0.4"   
##   "   Daily Smoker"                            ""       ""     "    "   
##   "   Former Smoker"                           ""       ""     "    "   
##   "   Never Smoked"                            ""       ""     "    "   
##   "   Occasional Smoker"                       ""       ""     "    "   
##   "CESD_10_0 (mean (SD))"                      " 0.005" ""     " 0.3"   
##   "Anxiety_0 = Yes (%)"                        " 0.589" ""     " 0.1"   
##   "Mood_Disord_0 = Yes (%)"                    " 0.604" ""     " 0.1"   
##   "Pet_Owner_0 = Yes (%)"                      "<0.001" ""     " 0.4"   
##   "PASE_TOTAL_0 (mean (SD))"                   "<0.001" ""     "19.1"   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "<0.001" ""     " 0.0"   
##   "RVLT_Delayed_Score_0 (mean (SD))"           "<0.001" ""     " 0.0"   
##   "MAT_Score_0 (mean (SD))"                    " 0.289" ""     " 0.0"   
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 0.030" ""     " 0.0"

4) Linear mixed model set-up

Linear mixed model set-up

Tracking.data.short<-Tracking.Adjusted_Final[c(1,4:12,14,15,18:21,13,140,141,28,57,86,30,59,88,23,52,80,26,55,84,91,108,125,95,112,129,99,116,133,
                                               103,120,137,92,109,126,96,113,130,100,117,134,104,121,138,105,122,139)]

Tracking.data.short2<-rename(Tracking.data.short, c("Age"="Age_0","Sex"="Sex_0","Ethnicity"="Ethnicity_0","Relationshipstatus"="Relationship_status_0",
                             "Education"="Education4_0", "IncomeLevel"="Income_Level_0", "Livingstatus"="Living_status_0", 
                             "Alcohol"="Alcohol_0", "SmokingStatus"="Smoking_Status_0","Anxiety"="Anxiety_0","MoodDisord"="Mood_Disord_0",
                             "Chronicconditions"="Chronic_conditions_0", "BMI"="BMI_0", "PASE_Total"="PASE_TOTAL_0"))

Tracking.data.short3<-Tracking.data.short2
Tracking.data.short4<-Tracking.data.short2[c(1:19,20,23,26,29,32,35,38,41,44,47,50,53,56,21,22,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46,
                                             48,49,51,52,54,55,57,58)]
colnames(Tracking.data.short3) <- (gsub("_2",".3",colnames(Tracking.data.short3)))
colnames(Tracking.data.short3) <- (gsub("_1",".2",colnames(Tracking.data.short3)))
colnames(Tracking.data.short3) <- (gsub("_0",".1",colnames(Tracking.data.short3)))

colnames(Tracking.data.short4) <- (gsub("_2",".2",colnames(Tracking.data.short4)))
colnames(Tracking.data.short4) <- (gsub("_1",".1",colnames(Tracking.data.short4)))
colnames(Tracking.data.short4) <- (gsub("_0","baseline",colnames(Tracking.data.short4)))


Tracking.data_long <- reshape(as.data.frame(Tracking.data.short3),idvar="ID",varying=20:58,direction="long",sep=".") #reshape data into long format (3 timepoints)
Tracking.data_long_2 <- reshape(as.data.frame(Tracking.data.short4),idvar="ID",varying=33:58,direction="long",sep=".") #reshape data into long format (3 timepoints)

Indexed time as a categorical factor

#Treat time as a fixed effect
Tracking.data_long$timefactor<-as.factor(Tracking.data_long$time)
Tracking.data_long_2$timefactor<-as.factor(Tracking.data_long_2$time)

5) Base model: Time x Pandemic effects on cognition, physical activity, and sleep duration (not adjusting for baseline)

Increase the data matrix to support the models

emm_options(rg.limit = 150000)

Contrast statements

#Contrast 1: Group differences from baseline to FU1
c1=matrix(c(0,1,0,-1,0,0))
c2=matrix(c(1,0,-1,0,0,0))
c1st=c1 - c2

#Contrast 2: Group differences from FU1 to FU2
c1=matrix(c(0,0,0,1,0,-1))
c2=matrix(c(0,0,1,0,-1,0))
c2nd = c1 - c2

#Contrast 3: Group differences from baseline to FU2
c1=matrix(c(0,1,0,0,0,-1))
c2=matrix(c(1,0,0,0,-1,0))
c3rd = c1 - c2

For each of the cognitive models, we used the normalized scores as the dependent variable. Baseline is not adjusted and no covariates were included.

5.1) RVLT Immediate Recall

5.1.1) Model

track.modelRVLT_imm_3<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + (1|ID), data= Tracking.data_long)
summary(track.modelRVLT_imm_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Immediate_Normed ~ timefactor * Pandemic + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 178154.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6062 -0.5765 -0.0440  0.5241  5.0473 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.477    2.340   
##  Residual             8.532    2.921   
## Number of obs: 33347, groups:  ID, 11355
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.013e+01  5.200e-02
## timefactor2                                             6.845e-01  5.784e-02
## timefactor3                                             9.738e-01  5.845e-02
## PandemicFU2 data collected before COVID-19              5.726e-01  7.052e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.406e-01  7.846e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.149e-01  7.891e-02
##                                                                df t value
## (Intercept)                                             2.566e+04 194.776
## timefactor2                                             2.209e+04  11.834
## timefactor3                                             2.222e+04  16.662
## PandemicFU2 data collected before COVID-19              2.566e+04   8.119
## timefactor2:PandemicFU2 data collected before COVID-19  2.209e+04  -3.067
## timefactor3:PandemicFU2 data collected before COVID-19  2.217e+04  -3.991
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             4.90e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19  0.00217 ** 
## timefactor3:PandemicFU2 data collected before COVID-19 6.59e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 tmfct3 PFdcbC t2dcbC
## timefactor2 -0.548                            
## timefactor3 -0.542  0.487                     
## PFU2dcbCOVI -0.737  0.404  0.400              
## t2:PFU2dcbC  0.404 -0.737 -0.359 -0.547       
## t3:PFU2dcbC  0.401 -0.361 -0.741 -0.544  0.490

5.1.2) Estimated marginal means

lsmeans(track.modelRVLT_imm_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.1 0.0520 Inf      10.0      10.2
##  FU2 data collected before COVID-19   10.7 0.0476 Inf      10.6      10.8
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.8 0.0525 Inf      10.7      10.9
##  FU2 data collected before COVID-19   11.1 0.0481 Inf      11.1      11.2
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.1 0.0532 Inf      11.0      11.2
##  FU2 data collected before COVID-19   11.4 0.0481 Inf      11.3      11.5
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(track.modelRVLT_imm_3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.573 0.0705 Inf  -8.119  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.332 0.0712 Inf  -4.662  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.258 0.0717 Inf  -3.593  0.0003
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(track.modelRVLT_imm_3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.573 0.0705 Inf    -0.711    -0.434
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.332 0.0712 Inf    -0.472    -0.192
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.258 0.0717 Inf    -0.398    -0.117
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

5.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_3 <- summary(lsmeans(track.modelRVLT_imm_3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_3$Time<-NA
RVLTimmediate_lsmeans_3$Time[RVLTimmediate_lsmeans_3$timefactor==1]<-"Baseline"
RVLTimmediate_lsmeans_3$Time[RVLTimmediate_lsmeans_3$timefactor==2]<-"Follow-up 1"
RVLTimmediate_lsmeans_3$Time[RVLTimmediate_lsmeans_3$timefactor==3]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_3, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

5.1.4) Planned contrasts

lsmeans.RVLTImm1 <- lsmeans(track.modelRVLT_imm_3, ~ Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33347)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm1,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2406 0.0785 Inf   3.067
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.0743 0.0795 Inf   0.935
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3149 0.0789 Inf   3.991
##  p.value
##   0.0022
##   0.3499
##   0.0001
## 
## Degrees-of-freedom method: asymptotic

5.2) RVLT Delayed Recall

5.2.1) Model

modelRVLT_del_3<- lmer(RVLT_Delayed_Normed ~ timefactor*Pandemic + (1|ID), data= Tracking.data_long)
summary(modelRVLT_del_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 175144.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8201 -0.5593 -0.0388  0.5068  5.0673 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.794    2.407   
##  Residual             7.766    2.787   
## Number of obs: 33150, groups:  ID, 11355
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.045e+01  5.116e-02
## timefactor2                                             5.168e-01  5.538e-02
## timefactor3                                             1.087e+00  5.598e-02
## PandemicFU2 data collected before COVID-19              4.873e-01  6.938e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -5.271e-02  7.510e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.268e-01  7.553e-02
##                                                                df t value
## (Intercept)                                             2.447e+04 204.162
## timefactor2                                             2.195e+04   9.331
## timefactor3                                             2.207e+04  19.423
## PandemicFU2 data collected before COVID-19              2.447e+04   7.023
## timefactor2:PandemicFU2 data collected before COVID-19  2.195e+04  -0.702
## timefactor3:PandemicFU2 data collected before COVID-19  2.201e+04  -4.327
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             2.23e-12 ***
## timefactor2:PandemicFU2 data collected before COVID-19    0.483    
## timefactor3:PandemicFU2 data collected before COVID-19 1.52e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 tmfct3 PFdcbC t2dcbC
## timefactor2 -0.529                            
## timefactor3 -0.523  0.484                     
## PFU2dcbCOVI -0.737  0.390  0.386              
## t2:PFU2dcbC  0.390 -0.737 -0.357 -0.529       
## t3:PFU2dcbC  0.388 -0.359 -0.741 -0.526  0.487

5.2.2) Estimated marginal means

lsmeans(modelRVLT_del_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.4 0.0512 Inf      10.3      10.5
##  FU2 data collected before COVID-19   10.9 0.0469 Inf      10.8      11.0
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.0 0.0518 Inf      10.9      11.1
##  FU2 data collected before COVID-19   11.4 0.0475 Inf      11.3      11.5
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.5 0.0525 Inf      11.4      11.6
##  FU2 data collected before COVID-19   11.7 0.0475 Inf      11.6      11.8
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.487 0.0694 Inf  -7.023  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.435 0.0703 Inf  -6.183  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.160 0.0707 Inf  -2.268  0.0233
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.487 0.0694 Inf    -0.623   -0.3513
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.435 0.0703 Inf    -0.572   -0.2968
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.160 0.0707 Inf    -0.299   -0.0218
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

5.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_3 <- summary(lsmeans(modelRVLT_del_3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_3$Time<-NA
RVLTdelayed_lsmeans_3$Time[RVLTdelayed_lsmeans_3$timefactor==1]<-"Baseline"
RVLTdelayed_lsmeans_3$Time[RVLTdelayed_lsmeans_3$timefactor==2]<-"Follow-up 1"
RVLTdelayed_lsmeans_3$Time[RVLTdelayed_lsmeans_3$timefactor==3]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_3, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

5.2.4) Planned contrasts

lsmeans.RVLTDel1 <- lsmeans(modelRVLT_del_3, ~ Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33150' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33150)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel1,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.0527 0.0751 Inf   0.702
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.2741 0.0763 Inf   3.592
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3268 0.0755 Inf   4.327
##  p.value
##   0.4828
##   0.0003
##   <.0001
## 
## Degrees-of-freedom method: asymptotic

5.3) Mental Alteration Test

5.3.1) Model

modelMAT_3<- lmer(MAT_Normed~ timefactor*Pandemic + (1|ID), data= Tracking.data_long)
summary(modelMAT_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 167568.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0453 -0.4679 -0.0205  0.4174  4.9277 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.319    2.306   
##  Residual             7.729    2.780   
## Number of obs: 31829, groups:  ID, 11355
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.820e+00  5.018e-02
## timefactor2                                             1.179e+00  5.656e-02
## timefactor3                                            -2.344e-01  5.702e-02
## PandemicFU2 data collected before COVID-19              2.448e-01  6.806e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -5.428e-01  7.657e-02
## timefactor3:PandemicFU2 data collected before COVID-19  1.161e-02  7.691e-02
##                                                                df t value
## (Intercept)                                             2.428e+04 195.679
## timefactor2                                             2.092e+04  20.843
## timefactor3                                             2.101e+04  -4.111
## PandemicFU2 data collected before COVID-19              2.428e+04   3.597
## timefactor2:PandemicFU2 data collected before COVID-19  2.089e+04  -7.089
## timefactor3:PandemicFU2 data collected before COVID-19  2.094e+04   0.151
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                            3.96e-05 ***
## PandemicFU2 data collected before COVID-19             0.000322 ***
## timefactor2:PandemicFU2 data collected before COVID-19 1.39e-12 ***
## timefactor3:PandemicFU2 data collected before COVID-19 0.880023    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 tmfct3 PFdcbC t2dcbC
## timefactor2 -0.526                            
## timefactor3 -0.521  0.465                     
## PFU2dcbCOVI -0.737  0.388  0.384              
## t2:PFU2dcbC  0.388 -0.739 -0.343 -0.527       
## t3:PFU2dcbC  0.387 -0.345 -0.741 -0.524  0.468

5.3.2) Estimated marginal means

lsmeans(modelMAT_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.82 0.0502 Inf      9.72      9.92
##  FU2 data collected before COVID-19  10.06 0.0460 Inf      9.97     10.15
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   11.00 0.0523 Inf     10.90     11.10
##  FU2 data collected before COVID-19  10.70 0.0477 Inf     10.61     10.79
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.59 0.0528 Inf      9.48      9.69
##  FU2 data collected before COVID-19   9.84 0.0477 Inf      9.75      9.94
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.245 0.0681 Inf  -3.597  0.0003
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##     0.298 0.0708 Inf   4.211  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.256 0.0711 Inf  -3.605  0.0003
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.245 0.0681 Inf    -0.378    -0.111
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##     0.298 0.0708 Inf     0.159     0.437
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.256 0.0711 Inf    -0.396    -0.117
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

5.3.3) Graph of estimated marginal means

MAT_lsmeans_3 <- summary(lsmeans(modelMAT_3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_3$Time<-NA
MAT_lsmeans_3$Time[MAT_lsmeans_3$timefactor==1]<-"Baseline"
MAT_lsmeans_3$Time[MAT_lsmeans_3$timefactor==2]<-"Follow-up 1"
MAT_lsmeans_3$Time[MAT_lsmeans_3$timefactor==3]<-"Follow-up 2"
ggplot(MAT_lsmeans_3, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

5.3.4) Planned contrasts

lsmeans.MAT1 <- lsmeans(modelMAT_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31829' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31829)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT1,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.5428 0.0766 Inf   7.089
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.5544 0.0792 Inf  -7.002
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0116 0.0769 Inf  -0.151
##  p.value
##   <.0001
##   <.0001
##   0.8800
## 
## Degrees-of-freedom method: asymptotic

5.4) Animal Fluency

5.4.1) Model

modelAnimals_3<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + (1|ID), data= Tracking.data_long)
summary(modelAnimals_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Animal_Fluency_Normed ~ timefactor * Pandemic + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 156896.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3392 -0.5628 -0.0186  0.5482  4.5591 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.041    2.245   
##  Residual             3.656    1.912   
## Number of obs: 33494, groups:  ID, 11355
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.019e+01  4.097e-02
## timefactor2                                            -8.038e-02  3.781e-02
## timefactor3                                            -1.899e-02  3.826e-02
## PandemicFU2 data collected before COVID-19              1.883e-01  5.556e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.083e-02  5.126e-02
## timefactor3:PandemicFU2 data collected before COVID-19  1.048e-02  5.160e-02
##                                                                df t value
## (Intercept)                                             2.020e+04 248.636
## timefactor2                                             2.220e+04  -2.126
## timefactor3                                             2.229e+04  -0.496
## PandemicFU2 data collected before COVID-19              2.020e+04   3.388
## timefactor2:PandemicFU2 data collected before COVID-19  2.219e+04  -0.406
## timefactor3:PandemicFU2 data collected before COVID-19  2.225e+04   0.203
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.033500 *  
## timefactor3                                            0.619625    
## PandemicFU2 data collected before COVID-19             0.000705 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.684453    
## timefactor3:PandemicFU2 data collected before COVID-19 0.839056    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 tmfct3 PFdcbC t2dcbC
## timefactor2 -0.456                            
## timefactor3 -0.450  0.488                     
## PFU2dcbCOVI -0.737  0.336  0.332              
## t2:PFU2dcbC  0.336 -0.738 -0.360 -0.456       
## t3:PFU2dcbC  0.334 -0.362 -0.741 -0.453  0.491

5.4.2) Estimated marginal means

lsmeans(modelAnimals_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.2 0.0410 Inf      10.1      10.3
##  FU2 data collected before COVID-19   10.4 0.0375 Inf      10.3      10.4
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.1 0.0412 Inf      10.0      10.2
##  FU2 data collected before COVID-19   10.3 0.0377 Inf      10.2      10.3
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.2 0.0416 Inf      10.1      10.2
##  FU2 data collected before COVID-19   10.4 0.0377 Inf      10.3      10.4
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.188 0.0556 Inf  -3.388  0.0007
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.167 0.0559 Inf  -2.998  0.0027
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.199 0.0562 Inf  -3.538  0.0004
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.188 0.0556 Inf    -0.297   -0.0794
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.167 0.0559 Inf    -0.277   -0.0580
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.199 0.0562 Inf    -0.309   -0.0887
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

5.4.3) Graph of estimated marginal means

Animals_lsmeans_3 <- summary(lsmeans(modelAnimals_3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_3$Time<-NA
Animals_lsmeans_3$Time[Animals_lsmeans_3$timefactor==1]<-"Baseline"
Animals_lsmeans_3$Time[Animals_lsmeans_3$timefactor==2]<-"Follow-up 1"
Animals_lsmeans_3$Time[Animals_lsmeans_3$timefactor==3]<-"Follow-up 2"
ggplot(Animals_lsmeans_3, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

5.4.4) Planned contrasts

lsmeans.Animals1 <- lsmeans(modelAnimals_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 33494' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 33494)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals1,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.0208 0.0513 Inf   0.406
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.0313 0.0519 Inf  -0.603
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0105 0.0516 Inf  -0.203
##  p.value
##   0.6844
##   0.5462
##   0.8391
## 
## Degrees-of-freedom method: asymptotic

5.5) Global cognition composite score

5.5.1) Models

modelGlobal_3<- lmer(Global_Composite ~ timefactor*Pandemic + (1|ID), data= Tracking.data_long)
summary(modelGlobal_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 152208.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7564 -0.5482 -0.0389  0.5055  4.1883 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.615    2.370   
##  Residual             4.279    2.069   
## Number of obs: 31434, groups:  ID, 11355
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.803e-01  4.370e-02
## timefactor2                                             8.171e-01  4.249e-02
## timefactor3                                             6.802e-01  4.278e-02
## PandemicFU2 data collected before COVID-19              4.967e-01  5.926e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.965e-01  5.756e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -2.381e-01  5.770e-02
##                                                                df t value
## (Intercept)                                             1.980e+04   4.125
## timefactor2                                             2.046e+04  19.230
## timefactor3                                             2.050e+04  15.899
## PandemicFU2 data collected before COVID-19              1.980e+04   8.380
## timefactor2:PandemicFU2 data collected before COVID-19  2.044e+04  -5.152
## timefactor3:PandemicFU2 data collected before COVID-19  2.046e+04  -4.127
##                                                        Pr(>|t|)    
## (Intercept)                                            3.72e-05 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19              < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 2.60e-07 ***
## timefactor3:PandemicFU2 data collected before COVID-19 3.69e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 tmfct3 PFdcbC t2dcbC
## timefactor2 -0.445                            
## timefactor3 -0.442  0.458                     
## PFU2dcbCOVI -0.737  0.328  0.326              
## t2:PFU2dcbC  0.328 -0.738 -0.338 -0.445       
## t3:PFU2dcbC  0.328 -0.339 -0.741 -0.444  0.461

5.5.2) Estimated marginal means

lsmeans(modelGlobal_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.180 0.0437 Inf    0.0946     0.266
##  FU2 data collected before COVID-19  0.677 0.0400 Inf    0.5985     0.755
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.997 0.0454 Inf    0.9083     1.086
##  FU2 data collected before COVID-19  1.197 0.0415 Inf    1.1161     1.279
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.860 0.0457 Inf    0.7709     0.950
##  FU2 data collected before COVID-19  1.119 0.0414 Inf    1.0379     1.200
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.497 0.0593 Inf  -8.380  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.200 0.0615 Inf  -3.252  0.0011
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.259 0.0617 Inf  -4.192  <.0001
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.497 0.0593 Inf    -0.613   -0.3805
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.200 0.0615 Inf    -0.321   -0.0795
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.259 0.0617 Inf    -0.379   -0.1377
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

5.5.3) Graph of estimated marginal means

Global_lsmeans_3 <- summary(lsmeans(modelGlobal_3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_3$Time<-NA
Global_lsmeans_3$Time[Global_lsmeans_3$timefactor==1]<-"Baseline"
Global_lsmeans_3$Time[Global_lsmeans_3$timefactor==2]<-"Follow-up 1"
Global_lsmeans_3$Time[Global_lsmeans_3$timefactor==3]<-"Follow-up 2"
ggplot(Global_lsmeans_3, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Global Cognitive Composite Score", title = "Global Cognitive Composite Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

5.5.4) Planned contrasts

lsmeans.Global1 <- lsmeans(modelGlobal_3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 31434' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 31434)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global1,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2966 0.0576 Inf   5.152
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.0584 0.0599 Inf  -0.976
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.2381 0.0577 Inf   4.127
##  p.value
##   <.0001
##   0.3289
##   <.0001
## 
## Degrees-of-freedom method: asymptotic

6) Base model: Time x Pandemic effects on cognition, physical activity, and sleep duration (adjusted for baseline)

Contrast statements

#Contrast 1: Group differences from baseline to FU1
c1=matrix(c(0,1,0,-1))
c2=matrix(c(1,0,-1,0))
c4th=c1 - c2

All cognitive models used normalized scores as the dependent variable. Baseline cognitive performance was included as a covariate. No other covariates were included.

6.1) RVLT Immediate Recall

6.1.1) Model

modelRVLT_imm_adj<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + RVLT_Immediate_Normedbaseline + (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_imm_adj)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + RVLT_Immediate_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 115453.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5846 -0.5593 -0.0308  0.5271  3.9457 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.40     2.098   
##  Residual             7.56     2.750   
## Number of obs: 21992, groups:  ID, 11325
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.224e+00  8.713e-02
## timefactor2                                             2.885e-01  5.551e-02
## PandemicFU2 data collected before COVID-19              1.291e-01  6.600e-02
## RVLT_Immediate_Normedbaseline                           3.542e-01  7.141e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -7.246e-02  7.493e-02
##                                                                df t value
## (Intercept)                                             1.368e+04  82.911
## timefactor2                                             1.109e+04   5.197
## PandemicFU2 data collected before COVID-19              1.958e+04   1.956
## RVLT_Immediate_Normedbaseline                           1.127e+04  49.598
## timefactor2:PandemicFU2 data collected before COVID-19  1.102e+04  -0.967
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            2.06e-07 ***
## PandemicFU2 data collected before COVID-19               0.0505 .  
## RVLT_Immediate_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19   0.3336    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 PFdcbC RVLT_I
## timefactor2 -0.312                     
## PFU2dcbCOVI -0.359  0.411              
## RVLT_Immd_N -0.830  0.001 -0.062       
## t2:PFU2dcbC  0.232 -0.741 -0.561 -0.001

6.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.9 0.0486 Inf      10.8      11.0
##  FU2 data collected before COVID-19   11.1 0.0445 Inf      11.0      11.1
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.2 0.0493 Inf      11.1      11.3
##  FU2 data collected before COVID-19   11.3 0.0446 Inf      11.2      11.4
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_adj, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.1291 0.0660 Inf  -1.956  0.0505
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0566 0.0665 Inf  -0.852  0.3944
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_adj, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.1291 0.0660 Inf    -0.258  0.000258
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0566 0.0665 Inf    -0.187  0.073713
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

6.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_adj <- summary(lsmeans(modelRVLT_imm_adj, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_adj$Time<-NA
RVLTimmediate_lsmeans_adj$Time[RVLTimmediate_lsmeans_adj$timefactor==1]<-"Follow-up 1"
RVLTimmediate_lsmeans_adj$Time[RVLTimmediate_lsmeans_adj$timefactor==2]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_adj, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

6.1.4) Planned contrasts

lsmeans.RVLTImm2 <- lsmeans(modelRVLT_imm_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21992' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21992)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm2,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   0.0725 0.0749 Inf   0.967
##  p.value
##   0.3336
## 
## Degrees-of-freedom method: asymptotic

6.2) RVLT Delayed Recall

6.2.1) Model

modelRVLT_del_adj<- lmer(RVLT_Delayed_Normed~ timefactor*Pandemic + RVLT_Delayed_Normedbaseline + (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_del_adj)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Delayed_Normed ~ timefactor * Pandemic + RVLT_Delayed_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 113063.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8852 -0.5489 -0.0326  0.5078  4.1922 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.283    2.069   
##  Residual             7.004    2.646   
## Number of obs: 21795, groups:  ID, 11307
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             6.795e+00  8.862e-02
## timefactor2                                             5.700e-01  5.382e-02
## PandemicFU2 data collected before COVID-19              2.406e-01  6.434e-02
## RVLT_Delayed_Normedbaseline                             3.988e-01  7.162e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -2.737e-01  7.258e-02
##                                                                df t value
## (Intercept)                                             1.341e+04  76.674
## timefactor2                                             1.101e+04  10.591
## PandemicFU2 data collected before COVID-19              1.937e+04   3.740
## RVLT_Delayed_Normedbaseline                             1.123e+04  55.680
## timefactor2:PandemicFU2 data collected before COVID-19  1.093e+04  -3.771
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             0.000185 ***
## RVLT_Delayed_Normedbaseline                             < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.000164 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 PFdcbC RVLT_D
## timefactor2 -0.298                     
## PFU2dcbCOVI -0.348  0.409              
## RVLT_Dlyd_N -0.845  0.001 -0.054       
## t2:PFU2dcbC  0.221 -0.741 -0.557  0.000

6.2.2) Estimated marginal means

lsmeans(modelRVLT_del_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.1 0.0474 Inf      11.0      11.2
##  FU2 data collected before COVID-19   11.3 0.0434 Inf      11.2      11.4
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.6 0.0481 Inf      11.5      11.7
##  FU2 data collected before COVID-19   11.6 0.0434 Inf      11.5      11.7
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_adj, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.2406 0.0643 Inf  -3.740  0.0002
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0331 0.0648 Inf   0.510  0.6100
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_adj, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.2406 0.0643 Inf    -0.367    -0.115
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0331 0.0648 Inf    -0.094     0.160
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

6.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_adj <- summary(lsmeans(modelRVLT_del_adj, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_adj$Time<-NA
RVLTdelayed_lsmeans_adj$Time[RVLTdelayed_lsmeans_adj$timefactor==1]<-"Follow-up 1"
RVLTdelayed_lsmeans_adj$Time[RVLTdelayed_lsmeans_adj$timefactor==2]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_adj, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

6.2.4) Planned contrasts

lsmeans.RVLTDel2 <- lsmeans(modelRVLT_del_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21795' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21795)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel2,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))    0.274 0.0726 Inf   3.771
##  p.value
##   0.0002
## 
## Degrees-of-freedom method: asymptotic

6.3) Mental Alteration Test

6.3.1) Model

modelMAT_adj<- lmer(MAT_Normed~ timefactor*Pandemic + MAT_Normedbaseline + (1|ID), data= Tracking.data_long_2)
summary(modelMAT_adj)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + MAT_Normedbaseline + (1 |  
##     ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 107052.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3284 -0.5035 -0.0867  0.3301  4.9371 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.735    1.654   
##  Residual             8.485    2.913   
## Number of obs: 20474, groups:  ID, 11171
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             6.555e+00  8.903e-02
## timefactor2                                            -1.416e+00  6.142e-02
## PandemicFU2 data collected before COVID-19             -4.083e-01  6.619e-02
## MAT_Normedbaseline                                      4.523e-01  7.521e-03
## timefactor2:PandemicFU2 data collected before COVID-19  5.584e-01  8.278e-02
##                                                                df t value
## (Intercept)                                             1.371e+04  73.634
## timefactor2                                             1.053e+04 -23.048
## PandemicFU2 data collected before COVID-19              1.972e+04  -6.169
## MAT_Normedbaseline                                      1.096e+04  60.139
## timefactor2:PandemicFU2 data collected before COVID-19  1.044e+04   6.746
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             6.99e-10 ***
## MAT_Normedbaseline                                      < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 1.60e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 PFdcbC MAT_Nr
## timefactor2 -0.339                     
## PFU2dcbCOVI -0.385  0.457              
## MAT_Nrmdbsl -0.836 -0.002 -0.026       
## t2:PFU2dcbC  0.251 -0.742 -0.620  0.001

6.3.2) Estimated marginal means

lsmeans(modelMAT_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   11.09 0.0489 Inf     11.00     11.19
##  FU2 data collected before COVID-19  10.68 0.0446 Inf     10.60     10.77
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.68 0.0495 Inf      9.58      9.77
##  FU2 data collected before COVID-19   9.83 0.0446 Inf      9.74      9.91
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_adj, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##     0.408 0.0662 Inf   6.169  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.150 0.0666 Inf  -2.253  0.0243
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_adj, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##     0.408 0.0662 Inf     0.279    0.5381
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.150 0.0666 Inf    -0.281   -0.0195
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

6.3.3) Graph of estimated marginal means

MAT_lsmeans_adj <- summary(lsmeans(modelMAT_adj, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_adj$Time<-NA
MAT_lsmeans_adj$Time[MAT_lsmeans_adj$timefactor==1]<-"Follow-up 1"
MAT_lsmeans_adj$Time[MAT_lsmeans_adj$timefactor==2]<-"Follow-up 2"
ggplot(MAT_lsmeans_adj, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

6.3.4) Planned contrasts

lsmeans.MAT2 <- lsmeans(modelMAT_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20474' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20474)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT2,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   -0.558 0.0828 Inf  -6.746
##  p.value
##   <.0001
## 
## Degrees-of-freedom method: asymptotic

6.4) Animal Fluency

6.4.1) Model

modelAnimals_adj<- lmer(Animal_Fluency_Normed~ timefactor*Pandemic + Animal_Fluency_Normedbaseline + (1|ID), data= Tracking.data_long_2)
summary(modelAnimals_adj)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Animal_Fluency_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 98964.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8744 -0.5507 -0.0246  0.5316  4.6145 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.453    1.566   
##  Residual             3.204    1.790   
## Number of obs: 22139, groups:  ID, 11334
## 
## Fixed effects:
##                                                         Estimate Std. Error
## (Intercept)                                            4.710e+00  7.132e-02
## timefactor2                                            6.205e-02  3.606e-02
## PandemicFU2 data collected before COVID-19             6.775e-02  4.516e-02
## Animal_Fluency_Normedbaseline                          5.297e-01  6.190e-03
## timefactor2:PandemicFU2 data collected before COVID-19 3.004e-02  4.862e-02
##                                                               df t value
## (Intercept)                                            1.274e+04  66.044
## timefactor2                                            1.113e+04   1.720
## PandemicFU2 data collected before COVID-19             1.885e+04   1.500
## Animal_Fluency_Normedbaseline                          1.126e+04  85.574
## timefactor2:PandemicFU2 data collected before COVID-19 1.106e+04   0.618
##                                                        Pr(>|t|)    
## (Intercept)                                              <2e-16 ***
## timefactor2                                              0.0854 .  
## PandemicFU2 data collected before COVID-19               0.1335    
## Animal_Fluency_Normedbaseline                            <2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19   0.5367    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 PFdcbC An_F_N
## timefactor2 -0.245                     
## PFU2dcbCOVI -0.321  0.390              
## Anml_Flnc_N -0.884 -0.001 -0.026       
## t2:PFU2dcbC  0.182 -0.742 -0.531  0.001

6.4.2) Estimated marginal means

lsmeans(modelAnimals_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.2 0.0333 Inf      10.1      10.2
##  FU2 data collected before COVID-19   10.2 0.0305 Inf      10.2      10.3
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.2 0.0338 Inf      10.2      10.3
##  FU2 data collected before COVID-19   10.3 0.0305 Inf      10.3      10.4
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_adj, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0678 0.0452 Inf  -1.500  0.1335
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0978 0.0455 Inf  -2.149  0.0317
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_adj, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0678 0.0452 Inf    -0.156   0.02075
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0978 0.0455 Inf    -0.187  -0.00859
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

6.4.3) Graph of estimated marginal means

Animals_lsmeans_adj <- summary(lsmeans(modelAnimals_adj, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_adj$Time<-NA
Animals_lsmeans_adj$Time[Animals_lsmeans_adj$timefactor==1]<-"Follow-up 1"
Animals_lsmeans_adj$Time[Animals_lsmeans_adj$timefactor==2]<-"Follow-up 2"
ggplot(Animals_lsmeans_adj, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

6.4.4) Planned contrasts

lsmeans.Animals2 <- lsmeans(modelAnimals_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 22139' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 22139)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals2,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))    -0.03 0.0486 Inf  -0.618
##  p.value
##   0.5366
## 
## Degrees-of-freedom method: asymptotic

6.5) Global Cognition

6.5.1) Model

modelGlobal_adj<- lmer(Global_Composite ~ timefactor*Pandemic + Global_Compositebaseline + (1|ID), data= Tracking.data_long_2)
summary(modelGlobal_adj)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + Global_Compositebaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 93704.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2426 -0.5447 -0.0477  0.5084  4.0570 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.706    1.645   
##  Residual             4.024    2.006   
## Number of obs: 20079, groups:  ID, 11110
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.982e-01  3.809e-02
## timefactor2                                            -1.371e-01  4.316e-02
## PandemicFU2 data collected before COVID-19             -7.305e-02  5.165e-02
## Global_Compositebaseline                                5.499e-01  6.710e-03
## timefactor2:PandemicFU2 data collected before COVID-19  5.825e-02  5.818e-02
##                                                                df t value
## (Intercept)                                             1.831e+04  23.577
## timefactor2                                             1.014e+04  -3.177
## PandemicFU2 data collected before COVID-19              1.828e+04  -1.414
## Global_Compositebaseline                                1.092e+04  81.946
## timefactor2:PandemicFU2 data collected before COVID-19  1.007e+04   1.001
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             0.00149 ** 
## PandemicFU2 data collected before COVID-19              0.15728    
## Global_Compositebaseline                                < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19  0.31674    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) tmfct2 PFdcbC Glbl_C
## timefactor2 -0.559                     
## PFU2dcbCOVI -0.734  0.412              
## Glbl_Cmpstb -0.042  0.003 -0.064       
## t2:PFU2dcbC  0.415 -0.742 -0.560 -0.001

6.5.2) Estimated marginal means

lsmeans(modelGlobal_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    1.18 0.0381 Inf     1.107      1.26
##  FU2 data collected before COVID-19   1.11 0.0348 Inf     1.041      1.18
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    1.04 0.0384 Inf     0.969      1.12
##  FU2 data collected before COVID-19   1.03 0.0347 Inf     0.962      1.10
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_adj, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0731 0.0517 Inf   1.414  0.1573
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0148 0.0518 Inf   0.286  0.7751
## 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_adj, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0731 0.0517 Inf   -0.0282     0.174
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0148 0.0518 Inf   -0.0867     0.116
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

6.5.3) Graph of estimated marginal means

Global_lsmeans_adj <- summary(lsmeans(modelGlobal_adj, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_adj$Time<-NA
Global_lsmeans_adj$Time[Global_lsmeans_adj$timefactor==1]<-"Follow-up 1"
Global_lsmeans_adj$Time[Global_lsmeans_adj$timefactor==2]<-"Follow-up 2"
ggplot(Global_lsmeans_adj, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "Global Cognitive Composite Score Score", title = "Global Cognitive Composite Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

6.5.4) Planned contrasts

lsmeans.Global2 <- lsmeans(modelGlobal_adj, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20079' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20079)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global2,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))  -0.0582 0.0582 Inf  -1.001
##  p.value
##   0.3167
## 
## Degrees-of-freedom method: asymptotic

7) Simple Adjusted Model: Time x Pandemic effects on cognition and physical activity (not adjusting for baseline)

All cognitive models used normalized scores. Each model is adjusted for age, sex, education level, ethnicity, and income level.

emm_options(rg.limit = 150000)

7.1) RVLT Immediate Recall

7.1.1) Model

modelRVLT_imm_7<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel +
                         (1|ID), data= Tracking.data_long)
summary(modelRVLT_imm_7)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 171754.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6061 -0.5778 -0.0456  0.5216  5.0392 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.296    2.301   
##  Residual             8.493    2.914   
## Number of obs: 32211, groups:  ID, 10961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.050e+00  2.499e-01
## timefactor2                                             6.938e-01  5.859e-02
## timefactor3                                             1.005e+00  5.921e-02
## PandemicFU2 data collected before COVID-19              5.404e-01  7.214e-02
## Age                                                     7.354e-04  2.869e-03
## SexM                                                   -6.536e-01  5.846e-02
## EducationHigh School Diploma                            1.772e-01  8.490e-02
## EducationLess than High School Diploma                  6.349e-01  1.166e-01
## EducationSome College                                   2.389e-01  1.068e-01
## EthnicityWhite                                          8.362e-01  1.679e-01
## IncomeLevel>$150k                                       1.198e+00  1.611e-01
## IncomeLevel$100-150k                                    9.262e-01  1.274e-01
## IncomeLevel$20-50k                                      2.562e-01  8.253e-02
## IncomeLevel$50-100k                                     7.624e-01  8.893e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.254e-01  7.961e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.217e-01  8.007e-02
##                                                                df t value
## (Intercept)                                             1.130e+04  36.207
## timefactor2                                             2.134e+04  11.842
## timefactor3                                             2.147e+04  16.980
## PandemicFU2 data collected before COVID-19              2.449e+04   7.491
## Age                                                     1.091e+04   0.256
## SexM                                                    1.091e+04 -11.179
## EducationHigh School Diploma                            1.092e+04   2.087
## EducationLess than High School Diploma                  1.099e+04   5.444
## EducationSome College                                   1.087e+04   2.236
## EthnicityWhite                                          1.090e+04   4.981
## IncomeLevel>$150k                                       1.092e+04   7.435
## IncomeLevel$100-150k                                    1.088e+04   7.271
## IncomeLevel$20-50k                                      1.092e+04   3.104
## IncomeLevel$50-100k                                     1.091e+04   8.574
## timefactor2:PandemicFU2 data collected before COVID-19  2.134e+04  -2.831
## timefactor3:PandemicFU2 data collected before COVID-19  2.141e+04  -4.017
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             7.08e-14 ***
## Age                                                     0.79771    
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                            0.03692 *  
## EducationLess than High School Diploma                 5.32e-08 ***
## EducationSome College                                   0.02538 *  
## EthnicityWhite                                         6.42e-07 ***
## IncomeLevel>$150k                                      1.12e-13 ***
## IncomeLevel$100-150k                                   3.82e-13 ***
## IncomeLevel$20-50k                                      0.00191 ** 
## IncomeLevel$50-100k                                     < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19  0.00465 ** 
## timefactor3:PandemicFU2 data collected before COVID-19 5.91e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 16 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

7.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.1 0.105 Inf      9.87      10.3
##  FU2 data collected before COVID-19   10.6 0.105 Inf     10.41      10.8
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.8 0.105 Inf     10.57      11.0
##  FU2 data collected before COVID-19   11.1 0.105 Inf     10.88      11.3
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.1 0.105 Inf     10.88      11.3
##  FU2 data collected before COVID-19   11.3 0.105 Inf     11.10      11.5
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_7, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.540 0.0721 Inf  -7.491  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.315 0.0728 Inf  -4.328  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.219 0.0733 Inf  -2.984  0.0028
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_7, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.540 0.0721 Inf    -0.682    -0.399
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.315 0.0728 Inf    -0.458    -0.172
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.219 0.0733 Inf    -0.362    -0.075
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

7.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_7 <- summary(lsmeans(modelRVLT_imm_7, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_7$Time<-NA
RVLTimmediate_lsmeans_7$Time[RVLTimmediate_lsmeans_7$timefactor==1]<-"Baseline"
RVLTimmediate_lsmeans_7$Time[RVLTimmediate_lsmeans_7$timefactor==2]<-"Follow-up 1"
RVLTimmediate_lsmeans_7$Time[RVLTimmediate_lsmeans_7$timefactor==3]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_7, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

7.1.4) Planned contrasts

lsmeans.RVLTImm3 <- lsmeans(modelRVLT_imm_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32211' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32211)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm3,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2254 0.0796 Inf   2.831
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.0963 0.0806 Inf   1.194
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3217 0.0801 Inf   4.017
##  p.value
##   0.0046
##   0.2325
##   0.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

7.2) RVLT Delayed Recall

7.2.1) Model

modelRVLT_del_7<- lmer(RVLT_Delayed_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel +
                        (1|ID), data= Tracking.data_long)
summary(modelRVLT_del_7)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 168972.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8393 -0.5606 -0.0391  0.5104  5.0697 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.642    2.375   
##  Residual             7.751    2.784   
## Number of obs: 32024, groups:  ID, 10961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.698e+00  2.517e-01
## timefactor2                                             5.258e-01  5.618e-02
## timefactor3                                             1.110e+00  5.677e-02
## PandemicFU2 data collected before COVID-19              4.403e-01  7.114e-02
## Age                                                     1.075e-02  2.890e-03
## SexM                                                   -6.076e-01  5.887e-02
## EducationHigh School Diploma                            3.403e-01  8.548e-02
## EducationLess than High School Diploma                  4.722e-01  1.176e-01
## EducationSome College                                   2.878e-01  1.075e-01
## EthnicityWhite                                          8.402e-01  1.694e-01
## IncomeLevel>$150k                                       1.011e+00  1.622e-01
## IncomeLevel$100-150k                                    9.228e-01  1.283e-01
## IncomeLevel$20-50k                                      3.182e-01  8.314e-02
## IncomeLevel$50-100k                                     7.758e-01  8.956e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -3.515e-02  7.631e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.266e-01  7.673e-02
##                                                                df t value
## (Intercept)                                             1.132e+04  34.550
## timefactor2                                             2.120e+04   9.360
## timefactor3                                             2.132e+04  19.550
## PandemicFU2 data collected before COVID-19              2.333e+04   6.189
## Age                                                     1.094e+04   3.718
## SexM                                                    1.092e+04 -10.321
## EducationHigh School Diploma                            1.093e+04   3.980
## EducationLess than High School Diploma                  1.106e+04   4.014
## EducationSome College                                   1.087e+04   2.676
## EthnicityWhite                                          1.099e+04   4.960
## IncomeLevel>$150k                                       1.091e+04   6.232
## IncomeLevel$100-150k                                    1.090e+04   7.193
## IncomeLevel$20-50k                                      1.094e+04   3.827
## IncomeLevel$50-100k                                     1.092e+04   8.663
## timefactor2:PandemicFU2 data collected before COVID-19  2.120e+04  -0.461
## timefactor3:PandemicFU2 data collected before COVID-19  2.126e+04  -4.257
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             6.17e-10 ***
## Age                                                    0.000202 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           6.92e-05 ***
## EducationLess than High School Diploma                 6.01e-05 ***
## EducationSome College                                  0.007455 ** 
## EthnicityWhite                                         7.15e-07 ***
## IncomeLevel>$150k                                      4.78e-10 ***
## IncomeLevel$100-150k                                   6.73e-13 ***
## IncomeLevel$20-50k                                     0.000130 ***
## IncomeLevel$50-100k                                     < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.645107    
## timefactor3:PandemicFU2 data collected before COVID-19 2.08e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 16 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

7.2.2) Estimated marginal means

lsmeans(modelRVLT_del_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.4 0.105 Inf      10.1      10.6
##  FU2 data collected before COVID-19   10.8 0.105 Inf      10.6      11.0
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.9 0.105 Inf      10.7      11.1
##  FU2 data collected before COVID-19   11.3 0.106 Inf      11.1      11.5
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.5 0.106 Inf      11.3      11.7
##  FU2 data collected before COVID-19   11.6 0.106 Inf      11.4      11.8
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_7, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.440 0.0711 Inf  -6.189  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.405 0.0720 Inf  -5.625  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.114 0.0725 Inf  -1.568  0.1168
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_7, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.440 0.0711 Inf    -0.580   -0.3008
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.405 0.0720 Inf    -0.546   -0.2640
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.114 0.0725 Inf    -0.256    0.0284
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

7.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_7 <- summary(lsmeans(modelRVLT_del_7, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_7$Time<-NA
RVLTdelayed_lsmeans_7$Time[RVLTdelayed_lsmeans_7$timefactor==1]<-"Baseline"
RVLTdelayed_lsmeans_7$Time[RVLTdelayed_lsmeans_7$timefactor==2]<-"Follow-up 1"
RVLTdelayed_lsmeans_7$Time[RVLTdelayed_lsmeans_7$timefactor==3]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_7, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

7.2.4) Planned contrasts

lsmeans.RVLTDel3 <- lsmeans(modelRVLT_del_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32024' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32024)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel3,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.0351 0.0763 Inf   0.461
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.2915 0.0775 Inf   3.760
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3266 0.0767 Inf   4.257
##  p.value
##   0.6451
##   0.0002
##   <.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

7.3) Mental Alteration Test

7.3.1) Model

modelMAT_7<- lmer(MAT_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel +
                    (1|ID), data= Tracking.data_long)
summary(modelMAT_7)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 161455.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1003 -0.4734 -0.0185  0.4253  4.8862 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.047    2.247   
##  Residual             7.684    2.772   
## Number of obs: 30761, groups:  ID, 10961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.745e+00  2.449e-01
## timefactor2                                             1.159e+00  5.726e-02
## timefactor3                                            -2.456e-01  5.770e-02
## PandemicFU2 data collected before COVID-19              1.342e-01  6.935e-02
## Age                                                    -2.369e-03  2.813e-03
## SexM                                                   -9.652e-01  5.717e-02
## EducationHigh School Diploma                           -1.402e-02  8.303e-02
## EducationLess than High School Diploma                 -2.118e-01  1.147e-01
## EducationSome College                                  -3.669e-02  1.042e-01
## EthnicityWhite                                          1.321e+00  1.646e-01
## IncomeLevel>$150k                                       8.113e-01  1.573e-01
## IncomeLevel$100-150k                                    1.000e+00  1.244e-01
## IncomeLevel$20-50k                                      3.765e-01  8.080e-02
## IncomeLevel$50-100k                                     7.398e-01  8.700e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -5.205e-01  7.763e-02
## timefactor3:PandemicFU2 data collected before COVID-19  1.626e-02  7.794e-02
##                                                                df t value
## (Intercept)                                             1.130e+04  35.715
## timefactor2                                             2.026e+04  20.236
## timefactor3                                             2.034e+04  -4.257
## PandemicFU2 data collected before COVID-19              2.332e+04   1.935
## Age                                                     1.096e+04  -0.842
## SexM                                                    1.085e+04 -16.882
## EducationHigh School Diploma                            1.086e+04  -0.169
## EducationLess than High School Diploma                  1.111e+04  -1.847
## EducationSome College                                   1.074e+04  -0.352
## EthnicityWhite                                          1.094e+04   8.026
## IncomeLevel>$150k                                       1.081e+04   5.157
## IncomeLevel$100-150k                                    1.080e+04   8.040
## IncomeLevel$20-50k                                      1.090e+04   4.660
## IncomeLevel$50-100k                                     1.086e+04   8.504
## timefactor2:PandemicFU2 data collected before COVID-19  2.023e+04  -6.705
## timefactor3:PandemicFU2 data collected before COVID-19  2.027e+04   0.209
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                            2.09e-05 ***
## PandemicFU2 data collected before COVID-19               0.0530 .  
## Age                                                      0.3999    
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                             0.8659    
## EducationLess than High School Diploma                   0.0648 .  
## EducationSome College                                    0.7248    
## EthnicityWhite                                         1.11e-15 ***
## IncomeLevel>$150k                                      2.56e-07 ***
## IncomeLevel$100-150k                                   9.96e-16 ***
## IncomeLevel$20-50k                                     3.20e-06 ***
## IncomeLevel$50-100k                                     < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 2.07e-11 ***
## timefactor3:PandemicFU2 data collected before COVID-19   0.8347    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 16 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

7.3.2) Estimated marginal means

lsmeans(modelMAT_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.30 0.102 Inf      9.10      9.50
##  FU2 data collected before COVID-19   9.43 0.103 Inf      9.23      9.63
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.46 0.103 Inf     10.25     10.66
##  FU2 data collected before COVID-19  10.07 0.103 Inf      9.87     10.27
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.05 0.103 Inf      8.85      9.25
##  FU2 data collected before COVID-19   9.20 0.103 Inf      9.00      9.41
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_7, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.134 0.0694 Inf  -1.935  0.0529
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##     0.386 0.0721 Inf   5.361  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.150 0.0724 Inf  -2.079  0.0376
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_7, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.134 0.0694 Inf    -0.270   0.00171
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##     0.386 0.0721 Inf     0.245   0.52752
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.150 0.0724 Inf    -0.292  -0.00860
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

7.3.3) Graph of estimated marginal means

MAT_lsmeans_7 <- summary(lsmeans(modelMAT_7, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_7$Time<-NA
MAT_lsmeans_7$Time[MAT_lsmeans_7$timefactor==1]<-"Baseline"
MAT_lsmeans_7$Time[MAT_lsmeans_7$timefactor==2]<-"Follow-up 1"
MAT_lsmeans_7$Time[MAT_lsmeans_7$timefactor==3]<-"Follow-up 2"
ggplot(MAT_lsmeans_7, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

7.3.4) Planned contrasts

lsmeans.MAT3 <- lsmeans(modelMAT_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30761' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30761)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT3,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.5205 0.0776 Inf   6.705
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.5368 0.0802 Inf  -6.692
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0163 0.0779 Inf  -0.209
##  p.value
##   <.0001
##   <.0001
##   0.8347
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

7.4) Animal Fluency

7.4.1) Model

modelAnimals_7<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel +
                        (1|ID), data= Tracking.data_long)
summary(modelAnimals_7)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 151298.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3310 -0.5632 -0.0182  0.5489  4.7037 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.916    2.217   
##  Residual             3.651    1.911   
## Number of obs: 32347, groups:  ID, 10961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.139e+00  2.158e-01
## timefactor2                                            -7.973e-02  3.837e-02
## timefactor3                                            -1.972e-02  3.882e-02
## PandemicFU2 data collected before COVID-19              2.106e-01  5.702e-02
## Age                                                    -9.285e-03  2.486e-03
## SexM                                                   -2.783e-01  5.066e-02
## EducationHigh School Diploma                            3.197e-01  7.357e-02
## EducationLess than High School Diploma                  4.108e-01  1.009e-01
## EducationSome College                                   2.551e-01  9.261e-02
## EthnicityWhite                                          1.397e+00  1.454e-01
## IncomeLevel>$150k                                       7.018e-01  1.396e-01
## IncomeLevel$100-150k                                    6.896e-01  1.104e-01
## IncomeLevel$20-50k                                      1.830e-01  7.151e-02
## IncomeLevel$50-100k                                     4.821e-01  7.706e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.362e-02  5.211e-02
## timefactor3:PandemicFU2 data collected before COVID-19  3.057e-03  5.245e-02
##                                                                df t value
## (Intercept)                                             1.117e+04  42.351
## timefactor2                                             2.144e+04  -2.078
## timefactor3                                             2.153e+04  -0.508
## PandemicFU2 data collected before COVID-19              1.928e+04   3.693
## Age                                                     1.095e+04  -3.735
## SexM                                                    1.094e+04  -5.492
## EducationHigh School Diploma                            1.096e+04   4.345
## EducationLess than High School Diploma                  1.098e+04   4.070
## EducationSome College                                   1.092e+04   2.755
## EthnicityWhite                                          1.094e+04   9.607
## IncomeLevel>$150k                                       1.095e+04   5.029
## IncomeLevel$100-150k                                    1.094e+04   6.244
## IncomeLevel$20-50k                                      1.095e+04   2.559
## IncomeLevel$50-100k                                     1.094e+04   6.256
## timefactor2:PandemicFU2 data collected before COVID-19  2.144e+04  -0.453
## timefactor3:PandemicFU2 data collected before COVID-19  2.149e+04   0.058
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.037722 *  
## timefactor3                                            0.611443    
## PandemicFU2 data collected before COVID-19             0.000222 ***
## Age                                                    0.000189 ***
## SexM                                                   4.05e-08 ***
## EducationHigh School Diploma                           1.41e-05 ***
## EducationLess than High School Diploma                 4.74e-05 ***
## EducationSome College                                  0.005879 ** 
## EthnicityWhite                                          < 2e-16 ***
## IncomeLevel>$150k                                      5.02e-07 ***
## IncomeLevel$100-150k                                   4.43e-10 ***
## IncomeLevel$20-50k                                     0.010512 *  
## IncomeLevel$50-100k                                    4.11e-10 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.650419    
## timefactor3:PandemicFU2 data collected before COVID-19 0.953525    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 16 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

7.4.2) Estimated marginal means

lsmeans(modelAnimals_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.78 0.0888 Inf      9.61      9.96
##  FU2 data collected before COVID-19  10.00 0.0894 Inf      9.82     10.17
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.71 0.0889 Inf      9.53      9.88
##  FU2 data collected before COVID-19   9.89 0.0895 Inf      9.72     10.07
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.77 0.0890 Inf      9.59      9.94
##  FU2 data collected before COVID-19   9.98 0.0895 Inf      9.80     10.15
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_7, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.211 0.0570 Inf  -3.693  0.0002
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.187 0.0573 Inf  -3.263  0.0011
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.214 0.0576 Inf  -3.708  0.0002
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_7, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.211 0.0570 Inf    -0.322   -0.0988
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.187 0.0573 Inf    -0.299   -0.0747
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.214 0.0576 Inf    -0.327   -0.1007
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

7.4.3) Graph of estimated marginal means

Animals_lsmeans_7 <- summary(lsmeans(modelAnimals_7, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_7$Time<-NA
Animals_lsmeans_7$Time[Animals_lsmeans_7$timefactor==1]<-"Baseline"
Animals_lsmeans_7$Time[Animals_lsmeans_7$timefactor==2]<-"Follow-up 1"
Animals_lsmeans_7$Time[Animals_lsmeans_7$timefactor==3]<-"Follow-up 2"
ggplot(Animals_lsmeans_7, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

7.4.4) Planned contrasts

lsmeans.Animals3 <- lsmeans(modelAnimals_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 32347' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 32347)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals3,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))  0.02362 0.0521 Inf   0.453
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L)) -0.02667 0.0527 Inf  -0.506
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L)) -0.00306 0.0525 Inf  -0.058
##  p.value
##   0.6504
##   0.6130
##   0.9535
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

7.5) Global cognition composite score

7.5.1) Models

modelGlobal_7<- lmer(Global_Composite ~ timefactor*Pandemic + + Age + Sex + Education + Ethnicity + IncomeLevel + 
                       (1|ID), data= Tracking.data_long)
summary(modelGlobal_7)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + +Age + Sex + Education +  
##     Ethnicity + IncomeLevel + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 146597.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7718 -0.5475 -0.0368  0.5086  4.2703 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.340    2.311   
##  Residual             4.256    2.063   
## Number of obs: 30384, groups:  ID, 10961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                            -1.853e+00  2.293e-01
## timefactor2                                             8.173e-01  4.302e-02
## timefactor3                                             6.924e-01  4.329e-02
## PandemicFU2 data collected before COVID-19              4.304e-01  6.035e-02
## Age                                                     5.696e-03  2.642e-03
## SexM                                                   -8.106e-01  5.373e-02
## EducationHigh School Diploma                            2.691e-01  7.798e-02
## EducationLess than High School Diploma                  4.553e-01  1.077e-01
## EducationSome College                                   2.122e-01  9.804e-02
## EthnicityWhite                                          1.475e+00  1.546e-01
## IncomeLevel>$150k                                       1.277e+00  1.478e-01
## IncomeLevel$100-150k                                    1.215e+00  1.170e-01
## IncomeLevel$20-50k                                      3.972e-01  7.588e-02
## IncomeLevel$50-100k                                     9.334e-01  8.171e-02
## timefactor2:PandemicFU2 data collected before COVID-19 -2.825e-01  5.836e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -2.390e-01  5.848e-02
##                                                                df t value
## (Intercept)                                             1.118e+04  -8.084
## timefactor2                                             1.980e+04  19.000
## timefactor3                                             1.984e+04  15.993
## PandemicFU2 data collected before COVID-19              1.905e+04   7.132
## Age                                                     1.097e+04   2.156
## SexM                                                    1.089e+04 -15.088
## EducationHigh School Diploma                            1.088e+04   3.451
## EducationLess than High School Diploma                  1.114e+04   4.228
## EducationSome College                                   1.080e+04   2.164
## EthnicityWhite                                          1.097e+04   9.542
## IncomeLevel>$150k                                       1.084e+04   8.637
## IncomeLevel$100-150k                                    1.084e+04  10.390
## IncomeLevel$20-50k                                      1.092e+04   5.235
## IncomeLevel$50-100k                                     1.088e+04  11.423
## timefactor2:PandemicFU2 data collected before COVID-19  1.979e+04  -4.841
## timefactor3:PandemicFU2 data collected before COVID-19  1.980e+04  -4.088
##                                                        Pr(>|t|)    
## (Intercept)                                            6.90e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             1.03e-12 ***
## Age                                                    0.031124 *  
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.000561 ***
## EducationLess than High School Diploma                 2.38e-05 ***
## EducationSome College                                  0.030479 *  
## EthnicityWhite                                          < 2e-16 ***
## IncomeLevel>$150k                                       < 2e-16 ***
## IncomeLevel$100-150k                                    < 2e-16 ***
## IncomeLevel$20-50k                                     1.68e-07 ***
## IncomeLevel$50-100k                                     < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 1.30e-06 ***
## timefactor3:PandemicFU2 data collected before COVID-19 4.37e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 16 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

7.5.2) Estimated marginal means

lsmeans(modelGlobal_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19  -0.173 0.0942 Inf    -0.358    0.0111
##  FU2 data collected before COVID-19  0.257 0.0949 Inf     0.071    0.4430
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.644 0.0950 Inf     0.458    0.8301
##  FU2 data collected before COVID-19  0.792 0.0956 Inf     0.604    0.9791
## 
## timefactor = 3:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.519 0.0952 Inf     0.332    0.7054
##  FU2 data collected before COVID-19  0.710 0.0955 Inf     0.523    0.8976
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_7, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.430 0.0604 Inf  -7.132  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.148 0.0626 Inf  -2.361  0.0182
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.191 0.0627 Inf  -3.050  0.0023
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_7, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.430 0.0604 Inf    -0.549   -0.3121
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.148 0.0626 Inf    -0.271   -0.0251
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.191 0.0627 Inf    -0.314   -0.0684
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

7.5.3) Graph of estimated marginal means

Global_lsmeans_7 <- summary(lsmeans(modelGlobal_7, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_7$Time<-NA
Global_lsmeans_7$Time[Global_lsmeans_7$timefactor==1]<-"Baseline"
Global_lsmeans_7$Time[Global_lsmeans_7$timefactor==2]<-"Follow-up 1"
Global_lsmeans_7$Time[Global_lsmeans_7$timefactor==3]<-"Follow-up 2"
ggplot(Global_lsmeans_7, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Global Cognitive Composite Score", title = "Global Cognitive Composite Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

7.5.4) Planned contrasts

lsmeans.Global3 <- lsmeans(modelGlobal_7, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 30384' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 30384)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global3,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2825 0.0584 Inf   4.841
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.0435 0.0606 Inf  -0.717
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.2390 0.0585 Inf   4.088
##  p.value
##   <.0001
##   0.4734
##   <.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

8) Simple Adjusted Model: Time x Pandemic effects on cognition, physical activity, and sleep duration (adjusted for baseline)

All models adjusted for baseline, age, sex, education level, ethnicity, income level

8.1) RVLT Immediate Recall

8.1.1) Model

modelRVLT_imm_adj3<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + RVLT_Immediate_Normedbaseline +
                            (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_imm_adj3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + RVLT_Immediate_Normedbaseline +      (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 111271.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6415 -0.5658 -0.0343  0.5293  3.8307 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.176    2.043   
##  Residual             7.553    2.748   
## Number of obs: 21250, groups:  ID, 10936
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.194e+00  2.533e-01
## timefactor2                                             3.090e-01  5.631e-02
## PandemicFU2 data collected before COVID-19              1.905e-01  6.742e-02
## Age                                                    -2.881e-02  2.866e-03
## SexM                                                   -4.640e-01  5.834e-02
## EducationHigh School Diploma                            1.805e-01  8.451e-02
## EducationLess than High School Diploma                  4.577e-01  1.164e-01
## EducationSome College                                   1.508e-01  1.062e-01
## EthnicityWhite                                          5.942e-01  1.672e-01
## IncomeLevel>$150k                                       7.517e-01  1.606e-01
## IncomeLevel$100-150k                                    6.567e-01  1.268e-01
## IncomeLevel$20-50k                                      2.418e-01  8.216e-02
## IncomeLevel$50-100k                                     5.780e-01  8.861e-02
## RVLT_Immediate_Normedbaseline                           3.545e-01  7.244e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -9.245e-02  7.615e-02
##                                                                df t value
## (Intercept)                                             1.109e+04  32.342
## timefactor2                                             1.072e+04   5.487
## PandemicFU2 data collected before COVID-19              1.882e+04   2.826
## Age                                                     1.088e+04 -10.051
## SexM                                                    1.086e+04  -7.954
## EducationHigh School Diploma                            1.088e+04   2.136
## EducationLess than High School Diploma                  1.101e+04   3.932
## EducationSome College                                   1.078e+04   1.420
## EthnicityWhite                                          1.081e+04   3.554
## IncomeLevel>$150k                                       1.085e+04   4.679
## IncomeLevel$100-150k                                    1.082e+04   5.179
## IncomeLevel$20-50k                                      1.088e+04   2.943
## IncomeLevel$50-100k                                     1.086e+04   6.523
## RVLT_Immediate_Normedbaseline                           1.088e+04  48.929
## timefactor2:PandemicFU2 data collected before COVID-19  1.066e+04  -1.214
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            4.18e-08 ***
## PandemicFU2 data collected before COVID-19              0.00472 ** 
## Age                                                     < 2e-16 ***
## SexM                                                   1.98e-15 ***
## EducationHigh School Diploma                            0.03273 *  
## EducationLess than High School Diploma                 8.48e-05 ***
## EducationSome College                                   0.15567    
## EthnicityWhite                                          0.00038 ***
## IncomeLevel>$150k                                      2.91e-06 ***
## IncomeLevel$100-150k                                   2.27e-07 ***
## IncomeLevel$20-50k                                      0.00326 ** 
## IncomeLevel$50-100k                                    7.21e-11 ***
## RVLT_Immediate_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19  0.22472    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 15 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

8.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.8 0.103 Inf      10.6      11.0
##  FU2 data collected before COVID-19   11.0 0.103 Inf      10.8      11.2
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.1 0.103 Inf      10.9      11.3
##  FU2 data collected before COVID-19   11.2 0.103 Inf      11.0      11.4
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_adj3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.1905 0.0674 Inf  -2.826  0.0047
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0981 0.0680 Inf  -1.443  0.1491
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_adj3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.1905 0.0674 Inf    -0.323   -0.0584
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0981 0.0680 Inf    -0.231    0.0351
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

8.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_adj3 <- summary(lsmeans(modelRVLT_imm_adj3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_adj3$Time<-NA
RVLTimmediate_lsmeans_adj3$Time[RVLTimmediate_lsmeans_adj3$timefactor==1]<-"Follow-up 1"
RVLTimmediate_lsmeans_adj3$Time[RVLTimmediate_lsmeans_adj3$timefactor==2]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_adj3, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

8.1.4) Planned contrasts

lsmeans.RVLTImm4 <- lsmeans(modelRVLT_imm_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21250' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21250)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm4,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   0.0925 0.0761 Inf   1.214
##  p.value
##   0.2247
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

8.2) RVLT Delayed Recall

8.2.1) Model

modelRVLT_del_adj3<- lmer(RVLT_Delayed_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + RVLT_Delayed_Normedbaseline +
                            (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_del_adj3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + RVLT_Delayed_Normedbaseline + (1 |      ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 109120.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9429 -0.5473 -0.0380  0.5072  4.1729 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.160    2.040   
##  Residual             7.003    2.646   
## Number of obs: 21063, groups:  ID, 10918
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.067e+00  2.505e-01
## timefactor2                                             5.822e-01  5.461e-02
## PandemicFU2 data collected before COVID-19              2.847e-01  6.604e-02
## Age                                                    -1.943e-02  2.828e-03
## SexM                                                   -4.248e-01  5.741e-02
## EducationHigh School Diploma                            2.504e-01  8.320e-02
## EducationLess than High School Diploma                  2.394e-01  1.151e-01
## EducationSome College                                   1.736e-01  1.045e-01
## EthnicityWhite                                          7.156e-01  1.653e-01
## IncomeLevel>$150k                                       6.427e-01  1.579e-01
## IncomeLevel$100-150k                                    5.286e-01  1.249e-01
## IncomeLevel$20-50k                                      2.425e-01  8.096e-02
## IncomeLevel$50-100k                                     6.082e-01  8.723e-02
## RVLT_Delayed_Normedbaseline                             3.992e-01  7.311e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -2.896e-01  7.378e-02
##                                                                df t value
## (Intercept)                                             1.115e+04  28.209
## timefactor2                                             1.065e+04  10.661
## PandemicFU2 data collected before COVID-19              1.856e+04   4.310
## Age                                                     1.090e+04  -6.869
## SexM                                                    1.085e+04  -7.400
## EducationHigh School Diploma                            1.085e+04   3.010
## EducationLess than High School Diploma                  1.108e+04   2.080
## EducationSome College                                   1.075e+04   1.662
## EthnicityWhite                                          1.092e+04   4.328
## IncomeLevel>$150k                                       1.083e+04   4.071
## IncomeLevel$100-150k                                    1.082e+04   4.234
## IncomeLevel$20-50k                                      1.089e+04   2.995
## IncomeLevel$50-100k                                     1.085e+04   6.972
## RVLT_Delayed_Normedbaseline                             1.084e+04  54.595
## timefactor2:PandemicFU2 data collected before COVID-19  1.058e+04  -3.925
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             1.64e-05 ***
## Age                                                    6.84e-12 ***
## SexM                                                   1.46e-13 ***
## EducationHigh School Diploma                            0.00262 ** 
## EducationLess than High School Diploma                  0.03751 *  
## EducationSome College                                   0.09657 .  
## EthnicityWhite                                         1.52e-05 ***
## IncomeLevel>$150k                                      4.71e-05 ***
## IncomeLevel$100-150k                                   2.32e-05 ***
## IncomeLevel$20-50k                                      0.00275 ** 
## IncomeLevel$50-100k                                    3.31e-12 ***
## RVLT_Delayed_Normedbaseline                             < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 8.72e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 15 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

8.2.2) Estimated marginal means

lsmeans(modelRVLT_del_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.9 0.101 Inf      10.7      11.1
##  FU2 data collected before COVID-19   11.2 0.102 Inf      11.0      11.4
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.4 0.101 Inf      11.2      11.6
##  FU2 data collected before COVID-19   11.4 0.102 Inf      11.2      11.6
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_adj3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##  -0.28466 0.0660 Inf  -4.310  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.00497 0.0665 Inf   0.075  0.9405
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_adj3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##  -0.28466 0.0660 Inf    -0.414    -0.155
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.00497 0.0665 Inf    -0.125     0.135
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

8.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_adj3 <- summary(lsmeans(modelRVLT_del_adj3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_adj3$Time<-NA
RVLTdelayed_lsmeans_adj3$Time[RVLTdelayed_lsmeans_adj3$timefactor==1]<-"Follow-up 1"
RVLTdelayed_lsmeans_adj3$Time[RVLTdelayed_lsmeans_adj3$timefactor==2]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_adj3, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

8.2.4) Planned contrasts

lsmeans.RVLTDel4 <- lsmeans(modelRVLT_del_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21063' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21063)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel4,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))     0.29 0.0738 Inf   3.925
##  p.value
##   0.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

8.3) Mental Alteration Test

8.3.1) Model

modelMAT_adj3<- lmer(MAT_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + MAT_Normedbaseline +
                      (1|ID), data= Tracking.data_long_2)
summary(modelMAT_adj3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + MAT_Normedbaseline + (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 102961.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4724 -0.5194 -0.0813  0.3623  4.8819 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.395    1.548   
##  Residual             8.438    2.905   
## Number of obs: 19800, groups:  ID, 10792
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.143e+00  2.420e-01
## timefactor2                                            -1.408e+00  6.210e-02
## PandemicFU2 data collected before COVID-19             -5.115e-01  6.711e-02
## Age                                                    -1.415e-02  2.710e-03
## SexM                                                   -1.122e+00  5.481e-02
## EducationHigh School Diploma                           -6.998e-02  7.956e-02
## EducationLess than High School Diploma                 -2.842e-01  1.114e-01
## EducationSome College                                  -1.918e-01  9.920e-02
## EthnicityWhite                                          8.658e-01  1.585e-01
## IncomeLevel>$150k                                       1.143e-01  1.506e-01
## IncomeLevel$100-150k                                    1.672e-01  1.193e-01
## IncomeLevel$20-50k                                      1.217e-01  7.764e-02
## IncomeLevel$50-100k                                     1.579e-01  8.366e-02
## MAT_Normedbaseline                                      4.487e-01  7.518e-03
## timefactor2:PandemicFU2 data collected before COVID-19  5.431e-01  8.382e-02
##                                                                df t value
## (Intercept)                                             1.091e+04  29.518
## timefactor2                                             1.022e+04 -22.677
## PandemicFU2 data collected before COVID-19              1.904e+04  -7.622
## Age                                                     1.069e+04  -5.221
## SexM                                                    1.052e+04 -20.466
## EducationHigh School Diploma                            1.050e+04  -0.880
## EducationLess than High School Diploma                  1.081e+04  -2.551
## EducationSome College                                   1.035e+04  -1.934
## EthnicityWhite                                          1.066e+04   5.462
## IncomeLevel>$150k                                       1.044e+04   0.759
## IncomeLevel$100-150k                                    1.046e+04   1.402
## IncomeLevel$20-50k                                      1.058e+04   1.567
## IncomeLevel$50-100k                                     1.051e+04   1.887
## MAT_Normedbaseline                                      1.057e+04  59.680
## timefactor2:PandemicFU2 data collected before COVID-19  1.013e+04   6.480
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             2.61e-14 ***
## Age                                                    1.81e-07 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                             0.3791    
## EducationLess than High School Diploma                   0.0107 *  
## EducationSome College                                    0.0532 .  
## EthnicityWhite                                         4.81e-08 ***
## IncomeLevel>$150k                                        0.4480    
## IncomeLevel$100-150k                                     0.1610    
## IncomeLevel$20-50k                                       0.1171    
## IncomeLevel$50-100k                                      0.0591 .  
## MAT_Normedbaseline                                      < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 9.58e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 15 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

8.3.2) Estimated marginal means

lsmeans(modelMAT_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.63 0.0984 Inf     10.44     10.82
##  FU2 data collected before COVID-19  10.12 0.0987 Inf      9.92     10.31
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.22 0.0986 Inf      9.03      9.41
##  FU2 data collected before COVID-19   9.25 0.0987 Inf      9.06      9.45
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_adj3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.5115 0.0671 Inf   7.622  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0316 0.0675 Inf  -0.469  0.6393
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_adj3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.5115 0.0671 Inf     0.380     0.643
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0316 0.0675 Inf    -0.164     0.101
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

8.3.3) Graph of estimated marginal means

MAT_lsmeans_adj3 <- summary(lsmeans(modelMAT_adj3, ~Pandemic|timefactor))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_adj3$Time<-NA
MAT_lsmeans_adj3$Time[MAT_lsmeans_adj3$timefactor==1]<-"Follow-up 1"
MAT_lsmeans_adj3$Time[MAT_lsmeans_adj3$timefactor==2]<-"Follow-up 2"
ggplot(MAT_lsmeans_adj3, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

8.3.4) Planned contrasts

lsmeans.MAT4 <- lsmeans(modelMAT_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19800' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19800)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT4,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   -0.543 0.0838 Inf  -6.480
##  p.value
##   <.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

8.4) Animal Fluency

8.4.1) Model

modelAnimals_adj3<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + Animal_Fluency_Normedbaseline +
                           (1|ID), data= Tracking.data_long_2)
summary(modelAnimals_adj3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + Animal_Fluency_Normedbaseline +      (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 95445.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9116 -0.5510 -0.0211  0.5305  4.7530 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.387    1.545   
##  Residual             3.202    1.789   
## Number of obs: 21386, groups:  ID, 10943
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             5.335e+00  1.823e-01
## timefactor2                                             5.965e-02  3.660e-02
## PandemicFU2 data collected before COVID-19              1.088e-01  4.639e-02
## Age                                                    -2.011e-02  2.016e-03
## SexM                                                   -1.487e-01  4.110e-02
## EducationHigh School Diploma                            2.225e-01  5.973e-02
## EducationLess than High School Diploma                  1.072e-01  8.206e-02
## EducationSome College                                   1.838e-01  7.499e-02
## EthnicityWhite                                          6.034e-01  1.183e-01
## IncomeLevel>$150k                                       1.189e-01  1.133e-01
## IncomeLevel$100-150k                                    1.489e-01  8.968e-02
## IncomeLevel$20-50k                                      1.515e-03  5.802e-02
## IncomeLevel$50-100k                                     1.656e-01  6.256e-02
## Animal_Fluency_Normedbaseline                           5.260e-01  6.297e-03
## timefactor2:PandemicFU2 data collected before COVID-19  2.642e-02  4.942e-02
##                                                                df t value
## (Intercept)                                             1.108e+04  29.261
## timefactor2                                             1.076e+04   1.630
## PandemicFU2 data collected before COVID-19              1.803e+04   2.346
## Age                                                     1.089e+04  -9.975
## SexM                                                    1.087e+04  -3.617
## EducationHigh School Diploma                            1.089e+04   3.725
## EducationLess than High School Diploma                  1.098e+04   1.307
## EducationSome College                                   1.082e+04   2.451
## EthnicityWhite                                          1.085e+04   5.103
## IncomeLevel>$150k                                       1.087e+04   1.049
## IncomeLevel$100-150k                                    1.086e+04   1.660
## IncomeLevel$20-50k                                      1.088e+04   0.026
## IncomeLevel$50-100k                                     1.087e+04   2.647
## Animal_Fluency_Normedbaseline                           1.086e+04  83.529
## timefactor2:PandemicFU2 data collected before COVID-19  1.068e+04   0.535
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.103178    
## PandemicFU2 data collected before COVID-19             0.018968 *  
## Age                                                     < 2e-16 ***
## SexM                                                   0.000300 ***
## EducationHigh School Diploma                           0.000196 ***
## EducationLess than High School Diploma                 0.191407    
## EducationSome College                                  0.014258 *  
## EthnicityWhite                                          3.4e-07 ***
## IncomeLevel>$150k                                      0.294009    
## IncomeLevel$100-150k                                   0.096843 .  
## IncomeLevel$20-50k                                     0.979174    
## IncomeLevel$50-100k                                    0.008135 ** 
## Animal_Fluency_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.592928    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 15 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

8.4.2) Estimated marginal means

lsmeans(modelAnimals_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.96 0.0721 Inf      9.82      10.1
##  FU2 data collected before COVID-19  10.07 0.0726 Inf      9.93      10.2
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.02 0.0723 Inf      9.88      10.2
##  FU2 data collected before COVID-19  10.16 0.0726 Inf     10.02      10.3
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_adj3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.109 0.0464 Inf  -2.346  0.0190
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.135 0.0468 Inf  -2.893  0.0038
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_adj3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.109 0.0464 Inf    -0.200   -0.0179
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.135 0.0468 Inf    -0.227   -0.0436
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

8.4.3) Graph of estimated marginal means

Animals_lsmeans_adj3 <- summary(lsmeans(modelAnimals_adj3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_adj3$Time<-NA
Animals_lsmeans_adj3$Time[Animals_lsmeans_adj3$timefactor==1]<-"Follow-up 1"
Animals_lsmeans_adj3$Time[Animals_lsmeans_adj3$timefactor==2]<-"Follow-up 2"
ggplot(Animals_lsmeans_adj3, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

8.3.4) Planned contrasts

lsmeans.Animals4 <- lsmeans(modelAnimals_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 21386' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 21386)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals4,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))  -0.0264 0.0494 Inf  -0.535
##  p.value
##   0.5929
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

8.5) Global cognition composite score

8.5.1) Model

modelGlobal_adj3<- lmer(Global_Composite ~ timefactor*Pandemic + + Age + Sex + Education + Ethnicity + IncomeLevel + Global_Compositebaseline +
                       (1|ID), data= Tracking.data_long_2)
summary(modelGlobal_adj3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + +Age + Sex + Education +  
##     Ethnicity + IncomeLevel + Global_Compositebaseline + (1 |      ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 90191.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3393 -0.5469 -0.0461  0.5066  3.9149 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.494    1.579   
##  Residual             4.019    2.005   
## Number of obs: 19423, groups:  ID, 10735
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.718e+00  1.951e-01
## timefactor2                                            -1.284e-01  4.372e-02
## PandemicFU2 data collected before COVID-19             -5.493e-02  5.250e-02
## Age                                                    -2.593e-02  2.246e-03
## SexM                                                   -6.131e-01  4.535e-02
## EducationHigh School Diploma                            1.651e-01  6.558e-02
## EducationLess than High School Diploma                  1.229e-01  9.230e-02
## EducationSome College                                   1.663e-02  8.199e-02
## EthnicityWhite                                          8.079e-01  1.311e-01
## IncomeLevel>$150k                                       4.120e-01  1.244e-01
## IncomeLevel$100-150k                                    3.799e-01  9.844e-02
## IncomeLevel$20-50k                                      1.877e-01  6.400e-02
## IncomeLevel$50-100k                                     4.048e-01  6.898e-02
## Global_Compositebaseline                                5.471e-01  6.784e-03
## timefactor2:PandemicFU2 data collected before COVID-19  4.606e-02  5.902e-02
##                                                                df t value
## (Intercept)                                             1.088e+04   8.805
## timefactor2                                             9.842e+03  -2.938
## PandemicFU2 data collected before COVID-19              1.765e+04  -1.046
## Age                                                     1.071e+04 -11.545
## SexM                                                    1.056e+04 -13.518
## EducationHigh School Diploma                            1.052e+04   2.518
## EducationLess than High School Diploma                  1.093e+04   1.332
## EducationSome College                                   1.039e+04   0.203
## EthnicityWhite                                          1.069e+04   6.164
## IncomeLevel>$150k                                       1.045e+04   3.314
## IncomeLevel$100-150k                                    1.051e+04   3.859
## IncomeLevel$20-50k                                      1.062e+04   2.933
## IncomeLevel$50-100k                                     1.055e+04   5.868
## Global_Compositebaseline                                1.054e+04  80.636
## timefactor2:PandemicFU2 data collected before COVID-19  9.774e+03   0.780
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.003311 ** 
## PandemicFU2 data collected before COVID-19             0.295423    
## Age                                                     < 2e-16 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.011829 *  
## EducationLess than High School Diploma                 0.182954    
## EducationSome College                                  0.839301    
## EthnicityWhite                                         7.35e-10 ***
## IncomeLevel>$150k                                      0.000924 ***
## IncomeLevel$100-150k                                   0.000115 ***
## IncomeLevel$20-50k                                     0.003359 ** 
## IncomeLevel$50-100k                                    4.54e-09 ***
## Global_Compositebaseline                                < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.435206    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 15 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

8.5.2) Estimated marginal means

lsmeans(modelGlobal_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.866 0.0801 Inf     0.709     1.023
##  FU2 data collected before COVID-19  0.811 0.0806 Inf     0.653     0.969
## 
## timefactor = 2:
##  Pandemic                           lsmean     SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.738 0.0803 Inf     0.581     0.895
##  FU2 data collected before COVID-19  0.729 0.0805 Inf     0.571     0.887
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_adj3, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.05493 0.0525 Inf   1.046  0.2954
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.00888 0.0526 Inf   0.169  0.8661
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_adj3, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.05493 0.0525 Inf   -0.0480     0.158
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.00888 0.0526 Inf   -0.0943     0.112
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

8.5.3) Graph of estimated marginal means

Global_lsmeans_adj3 <- summary(lsmeans(modelGlobal_adj3, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_adj3$Time<-NA
Global_lsmeans_adj3$Time[Global_lsmeans_adj3$timefactor==1]<-"Follow-up 1"
Global_lsmeans_adj3$Time[Global_lsmeans_adj3$timefactor==2]<-"Follow-up 2"
ggplot(Global_lsmeans_adj3, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "Global Cognitive Composite Score Score", title = "Global Cognitive Composite Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

8.5.4) Planned contrasts

lsmeans.Global4 <- lsmeans(modelGlobal_adj3, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19423' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19423)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global4,list(c4th),by=NULL)
##  contrast                                     estimate    SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))  -0.0461 0.059 Inf  -0.780
##  p.value
##   0.4352
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel 
## Degrees-of-freedom method: asymptotic

9) Full Adjusted Model: Time x Pandemic effects on cognition and physical activity (not adjusting for baseline)

All models use normalized cognitive scores.Each model is adjusted for baseline age, sex, education, ethnicity, income level, baseline BMI, baseline CESD-10 score, smoking status, relationship status at baseline, living status at baseline, diagnosis of anxiety or mood disorder at baseline, number of chronic conditions at baseline, and baseline PASE score

emm_options(rg.limit = 175000)

9.1) RVLT Immediate Recall

9.1.1) Model

modelRVLT_imm_8<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                         (1|ID), data= Tracking.data_long)
summary(modelRVLT_imm_8)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 132322.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6230 -0.5804 -0.0448  0.5230  5.1001 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.227    2.286   
##  Residual             8.338    2.888   
## Number of obs: 24887, groups:  ID, 8467
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.092e+00  4.293e-01
## timefactor2                                             7.000e-01  6.641e-02
## timefactor3                                             1.013e+00  6.709e-02
## PandemicFU2 data collected before COVID-19              5.421e-01  8.161e-02
## Age                                                     1.697e-02  4.072e-03
## SexM                                                   -7.871e-01  6.955e-02
## EducationHigh School Diploma                            2.312e-01  9.790e-02
## EducationLess than High School Diploma                  7.346e-01  1.383e-01
## EducationSome College                                   3.476e-01  1.218e-01
## EthnicityWhite                                          9.632e-01  1.941e-01
## IncomeLevel>$150k                                       8.978e-01  1.819e-01
## IncomeLevel$100-150k                                    5.815e-01  1.453e-01
## IncomeLevel$20-50k                                      8.931e-02  9.675e-02
## IncomeLevel$50-100k                                     5.424e-01  1.042e-01
## BMI                                                    -1.859e-02  6.571e-03
## CESD.20.1                                              -3.552e-02  7.818e-03
## SmokingStatusFormer Smoker                              1.920e-01  1.334e-01
## SmokingStatusNever Smoked                               3.584e-01  1.388e-01
## SmokingStatusOccasional Smoker                          2.849e-01  2.628e-01
## RelationshipstatusMarried                               1.057e-01  1.137e-01
## RelationshipstatusSeparated                            -1.018e-01  2.239e-01
## RelationshipstatusSingle                               -7.809e-02  1.536e-01
## RelationshipstatusWidowed                              -1.043e-01  1.553e-01
## LivingstatusAssisted Living                            -6.438e-01  4.609e-01
## LivingstatusHouse                                       1.093e-01  1.024e-01
## LivingstatusOther                                      -3.383e-01  3.822e-01
## AnxietyYes                                             -1.932e-02  1.367e-01
## MoodDisordYes                                          -1.291e-01  9.913e-02
## Chronicconditions                                      -3.727e-02  1.602e-02
## PASE_Total                                              3.077e-03  4.664e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -2.336e-01  8.985e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.202e-01  9.033e-02
##                                                                df t value
## (Intercept)                                             8.532e+03  18.849
## timefactor2                                             1.648e+04  10.541
## timefactor3                                             1.658e+04  15.104
## PandemicFU2 data collected before COVID-19              1.881e+04   6.642
## Age                                                     8.410e+03   4.166
## SexM                                                    8.405e+03 -11.316
## EducationHigh School Diploma                            8.410e+03   2.361
## EducationLess than High School Diploma                  8.469e+03   5.312
## EducationSome College                                   8.372e+03   2.854
## EthnicityWhite                                          8.367e+03   4.962
## IncomeLevel>$150k                                       8.408e+03   4.937
## IncomeLevel$100-150k                                    8.380e+03   4.001
## IncomeLevel$20-50k                                      8.412e+03   0.923
## IncomeLevel$50-100k                                     8.409e+03   5.204
## BMI                                                     8.393e+03  -2.829
## CESD.20.1                                               8.403e+03  -4.543
## SmokingStatusFormer Smoker                              8.409e+03   1.439
## SmokingStatusNever Smoked                               8.409e+03   2.582
## SmokingStatusOccasional Smoker                          8.357e+03   1.084
## RelationshipstatusMarried                               8.417e+03   0.930
## RelationshipstatusSeparated                             8.448e+03  -0.455
## RelationshipstatusSingle                                8.410e+03  -0.508
## RelationshipstatusWidowed                               8.423e+03  -0.672
## LivingstatusAssisted Living                             8.432e+03  -1.397
## LivingstatusHouse                                       8.412e+03   1.067
## LivingstatusOther                                       8.349e+03  -0.885
## AnxietyYes                                              8.402e+03  -0.141
## MoodDisordYes                                           8.403e+03  -1.303
## Chronicconditions                                       8.397e+03  -2.326
## PASE_Total                                              8.401e+03   6.597
## timefactor2:PandemicFU2 data collected before COVID-19  1.649e+04  -2.600
## timefactor3:PandemicFU2 data collected before COVID-19  1.654e+04  -3.545
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             3.18e-11 ***
## Age                                                    3.13e-05 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.018232 *  
## EducationLess than High School Diploma                 1.11e-07 ***
## EducationSome College                                  0.004325 ** 
## EthnicityWhite                                         7.11e-07 ***
## IncomeLevel>$150k                                      8.10e-07 ***
## IncomeLevel$100-150k                                   6.35e-05 ***
## IncomeLevel$20-50k                                     0.355947    
## IncomeLevel$50-100k                                    2.00e-07 ***
## BMI                                                    0.004682 ** 
## CESD.20.1                                              5.63e-06 ***
## SmokingStatusFormer Smoker                             0.150085    
## SmokingStatusNever Smoked                              0.009843 ** 
## SmokingStatusOccasional Smoker                         0.278288    
## RelationshipstatusMarried                              0.352565    
## RelationshipstatusSeparated                            0.649467    
## RelationshipstatusSingle                               0.611151    
## RelationshipstatusWidowed                              0.501874    
## LivingstatusAssisted Living                            0.162528    
## LivingstatusHouse                                      0.285969    
## LivingstatusOther                                      0.376102    
## AnxietyYes                                             0.887554    
## MoodDisordYes                                          0.192732    
## Chronicconditions                                      0.020038 *  
## PASE_Total                                             4.46e-11 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.009323 ** 
## timefactor3:PandemicFU2 data collected before COVID-19 0.000393 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

9.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19     9.6 0.211 Inf      9.18      10.0
##  FU2 data collected before COVID-19   10.1 0.211 Inf      9.73      10.6
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.3 0.211 Inf      9.88      10.7
##  FU2 data collected before COVID-19   10.6 0.211 Inf     10.19      11.0
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.6 0.211 Inf     10.20      11.0
##  FU2 data collected before COVID-19   10.8 0.211 Inf     10.42      11.2
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_8, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.542 0.0816 Inf  -6.642  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.308 0.0824 Inf  -3.745  0.0002
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.222 0.0829 Inf  -2.676  0.0075
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_8, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.542 0.0816 Inf    -0.702   -0.3821
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.308 0.0824 Inf    -0.470   -0.1470
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.222 0.0829 Inf    -0.384   -0.0593
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

9.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_8 <- summary(lsmeans(modelRVLT_imm_8, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_8$Time<-NA
RVLTimmediate_lsmeans_8$Time[RVLTimmediate_lsmeans_8$timefactor==1]<-"Baseline"
RVLTimmediate_lsmeans_8$Time[RVLTimmediate_lsmeans_8$timefactor==2]<-"Follow-up 1"
RVLTimmediate_lsmeans_8$Time[RVLTimmediate_lsmeans_8$timefactor==3]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_8, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Immediate Score", title = "RVLT Immediate Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

9.1.4) Planned contrasts

lsmeans.RVLTImm8 <- lsmeans(modelRVLT_imm_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24887' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24887)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm8,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2336 0.0898 Inf   2.600
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.0866 0.0910 Inf   0.952
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3202 0.0903 Inf   3.545
##  p.value
##   0.0093
##   0.3411
##   0.0004
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

9.2) RVLT Delayed Recall

9.2.1) Model

modelRVLT_del_8<- lmer(RVLT_Delayed_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                        (1|ID), data= Tracking.data_long)
summary(modelRVLT_del_8)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 130446.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8037 -0.5658 -0.0375  0.5152  5.0752 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.527    2.351   
##  Residual             7.723    2.779   
## Number of obs: 24749, groups:  ID, 8467
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.007e+00  4.324e-01
## timefactor2                                             5.565e-01  6.415e-02
## timefactor3                                             1.144e+00  6.477e-02
## PandemicFU2 data collected before COVID-19              4.631e-01  8.071e-02
## Age                                                     2.747e-02  4.101e-03
## SexM                                                   -7.259e-01  7.002e-02
## EducationHigh School Diploma                            4.000e-01  9.856e-02
## EducationLess than High School Diploma                  6.261e-01  1.394e-01
## EducationSome College                                   4.204e-01  1.226e-01
## EthnicityWhite                                          8.938e-01  1.960e-01
## IncomeLevel>$150k                                       7.253e-01  1.830e-01
## IncomeLevel$100-150k                                    6.365e-01  1.463e-01
## IncomeLevel$20-50k                                      1.841e-01  9.742e-02
## IncomeLevel$50-100k                                     5.737e-01  1.049e-01
## BMI                                                    -1.728e-02  6.615e-03
## CESD.20.1                                              -3.505e-02  7.875e-03
## SmokingStatusFormer Smoker                             -3.424e-02  1.343e-01
## SmokingStatusNever Smoked                               2.258e-01  1.397e-01
## SmokingStatusOccasional Smoker                          1.609e-01  2.647e-01
## RelationshipstatusMarried                              -1.034e-02  1.145e-01
## RelationshipstatusSeparated                            -4.531e-02  2.254e-01
## RelationshipstatusSingle                               -1.684e-01  1.546e-01
## RelationshipstatusWidowed                              -1.316e-01  1.563e-01
## LivingstatusAssisted Living                            -1.121e+00  4.643e-01
## LivingstatusHouse                                       7.413e-02  1.032e-01
## LivingstatusOther                                      -7.573e-02  3.852e-01
## AnxietyYes                                              1.417e-02  1.376e-01
## MoodDisordYes                                          -1.363e-01  9.978e-02
## Chronicconditions                                      -4.778e-02  1.613e-02
## PASE_Total                                              3.187e-03  4.696e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -6.479e-02  8.674e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -3.469e-01  8.719e-02
##                                                                df t value
## (Intercept)                                             8.543e+03  18.516
## timefactor2                                             1.638e+04   8.674
## timefactor3                                             1.647e+04  17.655
## PandemicFU2 data collected before COVID-19              1.803e+04   5.738
## Age                                                     8.419e+03   6.698
## SexM                                                    8.404e+03 -10.367
## EducationHigh School Diploma                            8.411e+03   4.058
## EducationLess than High School Diploma                  8.511e+03   4.491
## EducationSome College                                   8.367e+03   3.430
## EthnicityWhite                                          8.447e+03   4.561
## IncomeLevel>$150k                                       8.400e+03   3.963
## IncomeLevel$100-150k                                    8.384e+03   4.350
## IncomeLevel$20-50k                                      8.419e+03   1.890
## IncomeLevel$50-100k                                     8.409e+03   5.467
## BMI                                                     8.390e+03  -2.612
## CESD.20.1                                               8.419e+03  -4.450
## SmokingStatusFormer Smoker                              8.400e+03  -0.255
## SmokingStatusNever Smoked                               8.400e+03   1.616
## SmokingStatusOccasional Smoker                          8.376e+03   0.608
## RelationshipstatusMarried                               8.418e+03  -0.090
## RelationshipstatusSeparated                             8.459e+03  -0.201
## RelationshipstatusSingle                                8.402e+03  -1.089
## RelationshipstatusWidowed                               8.422e+03  -0.842
## LivingstatusAssisted Living                             8.451e+03  -2.414
## LivingstatusHouse                                       8.424e+03   0.719
## LivingstatusOther                                       8.385e+03  -0.197
## AnxietyYes                                              8.401e+03   0.103
## MoodDisordYes                                           8.398e+03  -1.366
## Chronicconditions                                       8.402e+03  -2.962
## PASE_Total                                              8.405e+03   6.786
## timefactor2:PandemicFU2 data collected before COVID-19  1.638e+04  -0.747
## timefactor3:PandemicFU2 data collected before COVID-19  1.642e+04  -3.979
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             9.71e-09 ***
## Age                                                    2.24e-11 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           4.99e-05 ***
## EducationLess than High School Diploma                 7.19e-06 ***
## EducationSome College                                  0.000607 ***
## EthnicityWhite                                         5.17e-06 ***
## IncomeLevel>$150k                                      7.46e-05 ***
## IncomeLevel$100-150k                                   1.38e-05 ***
## IncomeLevel$20-50k                                     0.058765 .  
## IncomeLevel$50-100k                                    4.70e-08 ***
## BMI                                                    0.009021 ** 
## CESD.20.1                                              8.68e-06 ***
## SmokingStatusFormer Smoker                             0.798693    
## SmokingStatusNever Smoked                              0.106064    
## SmokingStatusOccasional Smoker                         0.543271    
## RelationshipstatusMarried                              0.928035    
## RelationshipstatusSeparated                            0.840732    
## RelationshipstatusSingle                               0.276040    
## RelationshipstatusWidowed                              0.399758    
## LivingstatusAssisted Living                            0.015787 *  
## LivingstatusHouse                                      0.472411    
## LivingstatusOther                                      0.844147    
## AnxietyYes                                             0.917977    
## MoodDisordYes                                          0.171981    
## Chronicconditions                                      0.003066 ** 
## PASE_Total                                             1.23e-11 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.455094    
## timefactor3:PandemicFU2 data collected before COVID-19 6.96e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

9.2.2) Estimated marginal means

lsmeans(modelRVLT_del_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.0 0.212 Inf      9.59      10.4
##  FU2 data collected before COVID-19   10.5 0.212 Inf     10.06      10.9
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.6 0.212 Inf     10.15      11.0
##  FU2 data collected before COVID-19   11.0 0.212 Inf     10.55      11.4
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.2 0.213 Inf     10.73      11.6
##  FU2 data collected before COVID-19   11.3 0.212 Inf     10.85      11.7
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_8, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.463 0.0807 Inf  -5.738  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.398 0.0817 Inf  -4.876  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.116 0.0822 Inf  -1.414  0.1573
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_8, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.463 0.0807 Inf    -0.621   -0.3050
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.398 0.0817 Inf    -0.558   -0.2382
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.116 0.0822 Inf    -0.277    0.0448
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

9.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_8 <- summary(lsmeans(modelRVLT_del_8, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_8$Time<-NA
RVLTdelayed_lsmeans_8$Time[RVLTdelayed_lsmeans_8$timefactor==1]<-"Baseline"
RVLTdelayed_lsmeans_8$Time[RVLTdelayed_lsmeans_8$timefactor==2]<-"Follow-up 1"
RVLTdelayed_lsmeans_8$Time[RVLTdelayed_lsmeans_8$timefactor==3]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_8, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Delayed Score", title = "RVLT Delayed Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

9.2.4) Planned contrasts

lsmeans.RVLTDel8 <- lsmeans(modelRVLT_del_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 24749' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 24749)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel8,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.0648 0.0867 Inf   0.747
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.2821 0.0881 Inf   3.203
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.3469 0.0872 Inf   3.979
##  p.value
##   0.4551
##   0.0014
##   0.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

9.3) Mental Alteration Test

9.3.1) Model

modelMAT_8<- lmer(MAT_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                    (1|ID), data= Tracking.data_long)
summary(modelMAT_8)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 124671.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0904 -0.4700 -0.0150  0.4268  4.9654 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.976    2.231   
##  Residual             7.551    2.748   
## Number of obs: 23820, groups:  ID, 8467
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.839e+00  4.199e-01
## timefactor2                                             1.089e+00  6.490e-02
## timefactor3                                            -2.735e-01  6.533e-02
## PandemicFU2 data collected before COVID-19              5.771e-02  7.847e-02
## Age                                                    -1.312e-03  3.987e-03
## SexM                                                   -1.035e+00  6.793e-02
## EducationHigh School Diploma                            5.987e-03  9.568e-02
## EducationLess than High School Diploma                  3.372e-02  1.359e-01
## EducationSome College                                   5.522e-02  1.187e-01
## EthnicityWhite                                          1.339e+00  1.905e-01
## IncomeLevel>$150k                                       9.128e-01  1.776e-01
## IncomeLevel$100-150k                                    9.812e-01  1.419e-01
## IncomeLevel$20-50k                                      3.672e-01  9.463e-02
## IncomeLevel$50-100k                                     7.386e-01  1.019e-01
## BMI                                                    -2.572e-02  6.409e-03
## CESD.20.1                                              -4.432e-02  7.635e-03
## SmokingStatusFormer Smoker                              1.818e-01  1.301e-01
## SmokingStatusNever Smoked                               1.273e-01  1.354e-01
## SmokingStatusOccasional Smoker                          1.427e-01  2.567e-01
## RelationshipstatusMarried                               1.923e-01  1.112e-01
## RelationshipstatusSeparated                            -1.579e-01  2.184e-01
## RelationshipstatusSingle                                2.988e-01  1.500e-01
## RelationshipstatusWidowed                              -1.158e-01  1.520e-01
## LivingstatusAssisted Living                            -7.079e-01  4.507e-01
## LivingstatusHouse                                      -1.705e-01  1.002e-01
## LivingstatusOther                                      -3.714e-01  3.746e-01
## AnxietyYes                                              9.797e-02  1.333e-01
## MoodDisordYes                                           2.718e-01  9.668e-02
## Chronicconditions                                      -6.300e-02  1.568e-02
## PASE_Total                                             -9.834e-04  4.551e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -4.400e-01  8.757e-02
## timefactor3:PandemicFU2 data collected before COVID-19  6.328e-02  8.786e-02
##                                                                df t value
## (Intercept)                                             8.502e+03  23.435
## timefactor2                                             1.569e+04  16.774
## timefactor3                                             1.575e+04  -4.187
## PandemicFU2 data collected before COVID-19              1.795e+04   0.735
## Age                                                     8.412e+03  -0.329
## SexM                                                    8.346e+03 -15.230
## EducationHigh School Diploma                            8.363e+03   0.063
## EducationLess than High School Diploma                  8.559e+03   0.248
## EducationSome College                                   8.270e+03   0.465
## EthnicityWhite                                          8.436e+03   7.030
## IncomeLevel>$150k                                       8.342e+03   5.140
## IncomeLevel$100-150k                                    8.312e+03   6.917
## IncomeLevel$20-50k                                      8.392e+03   3.880
## IncomeLevel$50-100k                                     8.371e+03   7.248
## BMI                                                     8.290e+03  -4.014
## CESD.20.1                                               8.333e+03  -5.805
## SmokingStatusFormer Smoker                              8.311e+03   1.397
## SmokingStatusNever Smoked                               8.311e+03   0.940
## SmokingStatusOccasional Smoker                          8.291e+03   0.556
## RelationshipstatusMarried                               8.379e+03   1.730
## RelationshipstatusSeparated                             8.369e+03  -0.723
## RelationshipstatusSingle                                8.356e+03   1.991
## RelationshipstatusWidowed                               8.421e+03  -0.762
## LivingstatusAssisted Living                             8.384e+03  -1.571
## LivingstatusHouse                                       8.399e+03  -1.701
## LivingstatusOther                                       8.387e+03  -0.991
## AnxietyYes                                              8.313e+03   0.735
## MoodDisordYes                                           8.305e+03   2.811
## Chronicconditions                                       8.386e+03  -4.019
## PASE_Total                                              8.315e+03  -2.161
## timefactor2:PandemicFU2 data collected before COVID-19  1.566e+04  -5.024
## timefactor3:PandemicFU2 data collected before COVID-19  1.569e+04   0.720
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                            2.85e-05 ***
## PandemicFU2 data collected before COVID-19             0.462063    
## Age                                                    0.742155    
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.950105    
## EducationLess than High School Diploma                 0.804084    
## EducationSome College                                  0.641873    
## EthnicityWhite                                         2.22e-12 ***
## IncomeLevel>$150k                                      2.81e-07 ***
## IncomeLevel$100-150k                                   4.95e-12 ***
## IncomeLevel$20-50k                                     0.000105 ***
## IncomeLevel$50-100k                                    4.60e-13 ***
## BMI                                                    6.03e-05 ***
## CESD.20.1                                              6.67e-09 ***
## SmokingStatusFormer Smoker                             0.162483    
## SmokingStatusNever Smoked                              0.347271    
## SmokingStatusOccasional Smoker                         0.578360    
## RelationshipstatusMarried                              0.083696 .  
## RelationshipstatusSeparated                            0.469871    
## RelationshipstatusSingle                               0.046462 *  
## RelationshipstatusWidowed                              0.446282    
## LivingstatusAssisted Living                            0.116282    
## LivingstatusHouse                                      0.088955 .  
## LivingstatusOther                                      0.321493    
## AnxietyYes                                             0.462461    
## MoodDisordYes                                          0.004944 ** 
## Chronicconditions                                      5.91e-05 ***
## PASE_Total                                             0.030741 *  
## timefactor2:PandemicFU2 data collected before COVID-19 5.11e-07 ***
## timefactor3:PandemicFU2 data collected before COVID-19 0.471359    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

9.3.2) Estimated marginal means

lsmeans(modelMAT_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.31 0.206 Inf      8.91      9.72
##  FU2 data collected before COVID-19   9.37 0.206 Inf      8.97      9.78
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.40 0.207 Inf     10.00     10.81
##  FU2 data collected before COVID-19  10.02 0.207 Inf      9.61     10.42
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.04 0.207 Inf      8.63      9.45
##  FU2 data collected before COVID-19   9.16 0.207 Inf      8.76      9.57
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_8, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0577 0.0785 Inf  -0.735  0.4621
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.3823 0.0814 Inf   4.693  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.1210 0.0817 Inf  -1.480  0.1388
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_8, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0577 0.0785 Inf    -0.212    0.0961
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.3823 0.0814 Inf     0.223    0.5419
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.1210 0.0817 Inf    -0.281    0.0392
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

9.3.3) Graph of estimated marginal means

MAT_lsmeans_8 <- summary(lsmeans(modelMAT_8, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_8$Time<-NA
MAT_lsmeans_8$Time[MAT_lsmeans_8$timefactor==1]<-"Baseline"
MAT_lsmeans_8$Time[MAT_lsmeans_8$timefactor==2]<-"Follow-up 1"
MAT_lsmeans_8$Time[MAT_lsmeans_8$timefactor==3]<-"Follow-up 2"
ggplot(MAT_lsmeans_8, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "MAT Score", title = "Mental Alteration Test Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

9.3.4) Planned contrasts

lsmeans.MAT8 <- lsmeans(modelMAT_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23820' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23820)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT8,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.4400 0.0876 Inf   5.024
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.5033 0.0904 Inf  -5.569
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0633 0.0879 Inf  -0.720
##  p.value
##   <.0001
##   <.0001
##   0.4713
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

9.4) Animal Fluency

9.4.1) Model

modelAnimals_8<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                        (1|ID), data= Tracking.data_long)
summary(modelAnimals_8)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 116933.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3609 -0.5630 -0.0152  0.5500  4.7486 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.913    2.217   
##  Residual             3.633    1.906   
## Number of obs: 25010, groups:  ID, 8467
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.074e+00  3.740e-01
## timefactor2                                            -1.428e-01  4.377e-02
## timefactor3                                            -5.163e-02  4.426e-02
## PandemicFU2 data collected before COVID-19              1.729e-01  6.498e-02
## Age                                                    -1.770e-03  3.552e-03
## SexM                                                   -3.122e-01  6.067e-02
## EducationHigh School Diploma                            2.966e-01  8.542e-02
## EducationLess than High School Diploma                  4.156e-01  1.205e-01
## EducationSome College                                   2.496e-01  1.063e-01
## EthnicityWhite                                          1.308e+00  1.694e-01
## IncomeLevel>$150k                                       6.304e-01  1.586e-01
## IncomeLevel$100-150k                                    5.297e-01  1.268e-01
## IncomeLevel$20-50k                                      8.052e-02  8.438e-02
## IncomeLevel$50-100k                                     3.436e-01  9.092e-02
## BMI                                                    -1.565e-02  5.733e-03
## CESD.20.1                                              -3.527e-02  6.822e-03
## SmokingStatusFormer Smoker                              2.008e-01  1.164e-01
## SmokingStatusNever Smoked                               2.082e-01  1.211e-01
## SmokingStatusOccasional Smoker                          2.770e-01  2.295e-01
## RelationshipstatusMarried                              -1.813e-01  9.922e-02
## RelationshipstatusSeparated                            -1.565e-01  1.952e-01
## RelationshipstatusSingle                               -7.962e-02  1.340e-01
## RelationshipstatusWidowed                              -2.110e-01  1.354e-01
## LivingstatusAssisted Living                            -1.183e-01  4.018e-01
## LivingstatusHouse                                       3.409e-01  8.937e-02
## LivingstatusOther                                       1.257e-01  3.334e-01
## AnxietyYes                                             -7.203e-02  1.192e-01
## MoodDisordYes                                           2.103e-01  8.649e-02
## Chronicconditions                                      -1.593e-02  1.398e-02
## PASE_Total                                              9.462e-04  4.068e-04
## timefactor2:PandemicFU2 data collected before COVID-19  5.329e-02  5.918e-02
## timefactor3:PandemicFU2 data collected before COVID-19  7.531e-02  5.954e-02
##                                                                df t value
## (Intercept)                                             8.512e+03  24.266
## timefactor2                                             1.658e+04  -3.262
## timefactor3                                             1.665e+04  -1.166
## PandemicFU2 data collected before COVID-19              1.482e+04   2.660
## Age                                                     8.432e+03  -0.498
## SexM                                                    8.436e+03  -5.145
## EducationHigh School Diploma                            8.447e+03   3.473
## EducationLess than High School Diploma                  8.470e+03   3.449
## EducationSome College                                   8.421e+03   2.348
## EthnicityWhite                                          8.417e+03   7.722
## IncomeLevel>$150k                                       8.436e+03   3.974
## IncomeLevel$100-150k                                    8.427e+03   4.177
## IncomeLevel$20-50k                                      8.439e+03   0.954
## IncomeLevel$50-100k                                     8.439e+03   3.779
## BMI                                                     8.428e+03  -2.729
## CESD.20.1                                               8.441e+03  -5.170
## SmokingStatusFormer Smoker                              8.438e+03   1.725
## SmokingStatusNever Smoked                               8.436e+03   1.720
## SmokingStatusOccasional Smoker                          8.426e+03   1.207
## RelationshipstatusMarried                               8.454e+03  -1.827
## RelationshipstatusSeparated                             8.461e+03  -0.802
## RelationshipstatusSingle                                8.446e+03  -0.594
## RelationshipstatusWidowed                               8.440e+03  -1.559
## LivingstatusAssisted Living                             8.441e+03  -0.295
## LivingstatusHouse                                       8.450e+03   3.815
## LivingstatusOther                                       8.376e+03   0.377
## AnxietyYes                                              8.437e+03  -0.604
## MoodDisordYes                                           8.440e+03   2.431
## Chronicconditions                                       8.426e+03  -1.140
## PASE_Total                                              8.430e+03   2.326
## timefactor2:PandemicFU2 data collected before COVID-19  1.658e+04   0.900
## timefactor3:PandemicFU2 data collected before COVID-19  1.662e+04   1.265
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.001108 ** 
## timefactor3                                            0.243445    
## PandemicFU2 data collected before COVID-19             0.007818 ** 
## Age                                                    0.618234    
## SexM                                                   2.74e-07 ***
## EducationHigh School Diploma                           0.000518 ***
## EducationLess than High School Diploma                 0.000566 ***
## EducationSome College                                  0.018897 *  
## EthnicityWhite                                         1.27e-14 ***
## IncomeLevel>$150k                                      7.12e-05 ***
## IncomeLevel$100-150k                                   2.99e-05 ***
## IncomeLevel$20-50k                                     0.339992    
## IncomeLevel$50-100k                                    0.000159 ***
## BMI                                                    0.006359 ** 
## CESD.20.1                                              2.39e-07 ***
## SmokingStatusFormer Smoker                             0.084541 .  
## SmokingStatusNever Smoked                              0.085502 .  
## SmokingStatusOccasional Smoker                         0.227570    
## RelationshipstatusMarried                              0.067687 .  
## RelationshipstatusSeparated                            0.422670    
## RelationshipstatusSingle                               0.552441    
## RelationshipstatusWidowed                              0.119095    
## LivingstatusAssisted Living                            0.768355    
## LivingstatusHouse                                      0.000137 ***
## LivingstatusOther                                      0.706144    
## AnxietyYes                                             0.545818    
## MoodDisordYes                                          0.015064 *  
## Chronicconditions                                      0.254359    
## PASE_Total                                             0.020055 *  
## timefactor2:PandemicFU2 data collected before COVID-19 0.367881    
## timefactor3:PandemicFU2 data collected before COVID-19 0.205960    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

9.4.2) Estimated marginal means

lsmeans(modelAnimals_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.75 0.183 Inf      9.39     10.10
##  FU2 data collected before COVID-19   9.92 0.183 Inf      9.56     10.28
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.60 0.183 Inf      9.24      9.96
##  FU2 data collected before COVID-19   9.83 0.183 Inf      9.47     10.19
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.69 0.183 Inf      9.34     10.05
##  FU2 data collected before COVID-19   9.94 0.183 Inf      9.58     10.30
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_8, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.173 0.0650 Inf  -2.660  0.0078
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.226 0.0653 Inf  -3.465  0.0005
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.248 0.0656 Inf  -3.782  0.0002
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_8, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.173 0.0650 Inf    -0.300   -0.0455
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.226 0.0653 Inf    -0.354   -0.0982
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.248 0.0656 Inf    -0.377   -0.1195
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

9.4.3) Graph of estimated marginal means

Animals_lsmeans_8 <- summary(lsmeans(modelAnimals_8, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_8$Time<-NA
Animals_lsmeans_8$Time[Animals_lsmeans_8$timefactor==1]<-"Baseline"
Animals_lsmeans_8$Time[Animals_lsmeans_8$timefactor==2]<-"Follow-up 1"
Animals_lsmeans_8$Time[Animals_lsmeans_8$timefactor==3]<-"Follow-up 2"
ggplot(Animals_lsmeans_8, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Animal Fluency (words)", title = "Animal Fluency Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

9.4.4) Planned contrasts

lsmeans.Animals8 <- lsmeans(modelAnimals_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 25010' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 25010)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals8,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))  -0.0533 0.0592 Inf  -0.900
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.0220 0.0599 Inf  -0.368
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0753 0.0595 Inf  -1.265
##  p.value
##   0.3679
##   0.7130
##   0.2059
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

9.5) Global cognition composite score

9.5.1) Models

modelGlobal_8<- lmer(Global_Composite ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                       (1|ID), data= Tracking.data_long)
summary(modelGlobal_8)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: Tracking.data_long
## 
## REML criterion at convergence: 113116.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7686 -0.5454 -0.0341  0.5097  4.2221 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.234    2.288   
##  Residual             4.177    2.044   
## Number of obs: 23529, groups:  ID, 8467
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                            -1.989e+00  3.931e-01
## timefactor2                                             7.798e-01  4.873e-02
## timefactor3                                             6.980e-01  4.898e-02
## PandemicFU2 data collected before COVID-19              4.017e-01  6.819e-02
## Age                                                     1.868e-02  3.738e-03
## SexM                                                   -9.194e-01  6.372e-02
## EducationHigh School Diploma                            2.965e-01  8.968e-02
## EducationLess than High School Diploma                  6.160e-01  1.273e-01
## EducationSome College                                   3.090e-01  1.115e-01
## EthnicityWhite                                          1.542e+00  1.784e-01
## IncomeLevel>$150k                                       1.122e+00  1.665e-01
## IncomeLevel$100-150k                                    9.451e-01  1.331e-01
## IncomeLevel$20-50k                                      2.693e-01  8.869e-02
## IncomeLevel$50-100k                                     7.564e-01  9.550e-02
## BMI                                                    -2.599e-02  6.014e-03
## CESD.20.1                                              -5.046e-02  7.163e-03
## SmokingStatusFormer Smoker                              1.761e-01  1.221e-01
## SmokingStatusNever Smoked                               2.944e-01  1.271e-01
## SmokingStatusOccasional Smoker                          3.256e-01  2.409e-01
## RelationshipstatusMarried                              -1.786e-02  1.042e-01
## RelationshipstatusSeparated                            -2.032e-01  2.049e-01
## RelationshipstatusSingle                               -3.526e-02  1.407e-01
## RelationshipstatusWidowed                              -2.292e-01  1.425e-01
## LivingstatusAssisted Living                            -7.468e-01  4.232e-01
## LivingstatusHouse                                       1.217e-01  9.392e-02
## LivingstatusOther                                      -1.164e-01  3.516e-01
## AnxietyYes                                              9.991e-04  1.251e-01
## MoodDisordYes                                           8.159e-02  9.071e-02
## Chronicconditions                                      -5.259e-02  1.470e-02
## PASE_Total                                              2.032e-03  4.270e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -2.348e-01  6.577e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -2.348e-01  6.588e-02
##                                                                df t value
## (Intercept)                                             8.477e+03  -5.059
## timefactor2                                             1.534e+04  16.002
## timefactor3                                             1.537e+04  14.250
## PandemicFU2 data collected before COVID-19              1.467e+04   5.891
## Age                                                     8.429e+03   4.997
## SexM                                                    8.373e+03 -14.429
## EducationHigh School Diploma                            8.375e+03   3.306
## EducationLess than High School Diploma                  8.564e+03   4.840
## EducationSome College                                   8.319e+03   2.771
## EthnicityWhite                                          8.439e+03   8.640
## IncomeLevel>$150k                                       8.356e+03   6.738
## IncomeLevel$100-150k                                    8.339e+03   7.103
## IncomeLevel$20-50k                                      8.399e+03   3.036
## IncomeLevel$50-100k                                     8.379e+03   7.921
## BMI                                                     8.332e+03  -4.322
## CESD.20.1                                               8.372e+03  -7.044
## SmokingStatusFormer Smoker                              8.351e+03   1.442
## SmokingStatusNever Smoked                               8.350e+03   2.317
## SmokingStatusOccasional Smoker                          8.343e+03   1.352
## RelationshipstatusMarried                               8.396e+03  -0.171
## RelationshipstatusSeparated                             8.400e+03  -0.992
## RelationshipstatusSingle                                8.368e+03  -0.251
## RelationshipstatusWidowed                               8.437e+03  -1.609
## LivingstatusAssisted Living                             8.439e+03  -1.765
## LivingstatusHouse                                       8.404e+03   1.296
## LivingstatusOther                                       8.431e+03  -0.331
## AnxietyYes                                              8.342e+03   0.008
## MoodDisordYes                                           8.335e+03   0.900
## Chronicconditions                                       8.401e+03  -3.578
## PASE_Total                                              8.350e+03   4.760
## timefactor2:PandemicFU2 data collected before COVID-19  1.532e+04  -3.570
## timefactor3:PandemicFU2 data collected before COVID-19  1.533e+04  -3.565
##                                                        Pr(>|t|)    
## (Intercept)                                            4.30e-07 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             3.92e-09 ***
## Age                                                    5.95e-07 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.000950 ***
## EducationLess than High School Diploma                 1.32e-06 ***
## EducationSome College                                  0.005593 ** 
## EthnicityWhite                                          < 2e-16 ***
## IncomeLevel>$150k                                      1.71e-11 ***
## IncomeLevel$100-150k                                   1.32e-12 ***
## IncomeLevel$20-50k                                     0.002402 ** 
## IncomeLevel$50-100k                                    2.67e-15 ***
## BMI                                                    1.56e-05 ***
## CESD.20.1                                              2.02e-12 ***
## SmokingStatusFormer Smoker                             0.149421    
## SmokingStatusNever Smoked                              0.020507 *  
## SmokingStatusOccasional Smoker                         0.176568    
## RelationshipstatusMarried                              0.863936    
## RelationshipstatusSeparated                            0.321358    
## RelationshipstatusSingle                               0.802093    
## RelationshipstatusWidowed                              0.107733    
## LivingstatusAssisted Living                            0.077659 .  
## LivingstatusHouse                                      0.195067    
## LivingstatusOther                                      0.740532    
## AnxietyYes                                             0.993627    
## MoodDisordYes                                          0.368398    
## Chronicconditions                                      0.000348 ***
## PASE_Total                                             1.97e-06 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.000357 ***
## timefactor3:PandemicFU2 data collected before COVID-19 0.000366 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

9.5.2) Estimated marginal means

lsmeans(modelGlobal_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                             lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19  -0.39967 0.192 Inf  -0.77664   -0.0227
##  FU2 data collected before COVID-19  0.00205 0.193 Inf  -0.37525    0.3794
## 
## timefactor = 2:
##  Pandemic                             lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.38015 0.193 Inf   0.00204    0.7583
##  FU2 data collected before COVID-19  0.54703 0.193 Inf   0.16884    0.9252
## 
## timefactor = 3:
##  Pandemic                             lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.29835 0.193 Inf  -0.07967    0.6764
##  FU2 data collected before COVID-19  0.46524 0.193 Inf   0.08730    0.8432
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_8, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.402 0.0682 Inf  -5.891  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.167 0.0707 Inf  -2.360  0.0183
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.167 0.0708 Inf  -2.358  0.0184
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_8, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.402 0.0682 Inf    -0.535   -0.2681
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.167 0.0707 Inf    -0.305   -0.0283
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.167 0.0708 Inf    -0.306   -0.0281
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

9.5.3) Graph of estimated marginal means

Global_lsmeans_8 <- summary(lsmeans(modelGlobal_8, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_8$Time<-NA
Global_lsmeans_8$Time[Global_lsmeans_8$timefactor==1]<-"Baseline"
Global_lsmeans_8$Time[Global_lsmeans_8$timefactor==2]<-"Follow-up 1"
Global_lsmeans_8$Time[Global_lsmeans_8$timefactor==3]<-"Follow-up 2"
ggplot(Global_lsmeans_8, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Global Cognitive Composite Score", title = "Global Cognitive Composite Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

9.5.4) Planned contrasts

lsmeans.Global8 <- lsmeans(modelGlobal_8, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 23529' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 23529)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global8,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                            estimate     SE  df
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))  2.35e-01 0.0658 Inf
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L)) -1.24e-05 0.0683 Inf
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  2.35e-01 0.0659 Inf
##  z.ratio p.value
##    3.570  0.0004
##    0.000  0.9999
##    3.565  0.0004
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

10) Full Adjusted Model: Time x Pandemic effects on cognition and physical activity ( adjusting for baseline)

All models use normalized cognitive scores. Each model is adjusted for baseline age, sex, education, ethnicity, income level, baseline BMI, baseline CESD-10 score, smoking status, relationship status at baseline, living status at baseline, diagnosis of anxiety or mood disorder at baseline, number of chronic conditions at baseline, baseline PASE score, and baseline cognitive performance

10.1) RVLT Immediate Recall

10.1.1) Model

modelRVLT_imm_adj10<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + RVLT_Immediate_Normedbaseline +
                            (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_imm_adj10)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + RVLT_Immediate_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 85610
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7099 -0.5660 -0.0356  0.5277  3.8353 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.089    2.022   
##  Residual             7.350    2.711   
## Number of obs: 16420, groups:  ID, 8448
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.454e+00  4.279e-01
## timefactor2                                             3.108e-01  6.352e-02
## PandemicFU2 data collected before COVID-19              1.794e-01  7.598e-02
## Age                                                    -1.474e-02  4.052e-03
## SexM                                                   -5.715e-01  6.915e-02
## EducationHigh School Diploma                            2.724e-01  9.700e-02
## EducationLess than High School Diploma                  5.141e-01  1.374e-01
## EducationSome College                                   2.371e-01  1.205e-01
## EthnicityWhite                                          4.852e-01  1.922e-01
## IncomeLevel>$150k                                       4.738e-01  1.804e-01
## IncomeLevel$100-150k                                    4.078e-01  1.439e-01
## IncomeLevel$20-50k                                      1.463e-01  9.587e-02
## IncomeLevel$50-100k                                     4.242e-01  1.033e-01
## BMI                                                    -1.687e-02  6.507e-03
## CESD.10baseline                                        -2.594e-02  7.747e-03
## SmokingStatusFormer Smoker                              1.758e-01  1.321e-01
## SmokingStatusNever Smoked                               2.787e-01  1.375e-01
## SmokingStatusOccasional Smoker                         -2.838e-02  2.599e-01
## RelationshipstatusMarried                               3.161e-01  1.127e-01
## RelationshipstatusSeparated                             2.365e-01  2.221e-01
## RelationshipstatusSingle                                1.878e-01  1.522e-01
## RelationshipstatusWidowed                               1.763e-02  1.539e-01
## LivingstatusAssisted Living                            -8.328e-01  4.570e-01
## LivingstatusHouse                                       4.362e-02  1.015e-01
## LivingstatusOther                                      -3.584e-01  3.776e-01
## AnxietyYes                                              6.747e-02  1.354e-01
## MoodDisordYes                                          -1.642e-01  9.819e-02
## Chronicconditions                                      -2.306e-02  1.587e-02
## PASE_Total                                              2.277e-03  4.624e-04
## RVLT_Immediate_Normedbaseline                           3.512e-01  8.160e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -8.311e-02  8.553e-02
##                                                                df t value
## (Intercept)                                             8.446e+03  17.419
## timefactor2                                             8.281e+03   4.893
## PandemicFU2 data collected before COVID-19              1.448e+04   2.361
## Age                                                     8.385e+03  -3.638
## SexM                                                    8.376e+03  -8.264
## EducationHigh School Diploma                            8.375e+03   2.808
## EducationLess than High School Diploma                  8.502e+03   3.741
## EducationSome College                                   8.296e+03   1.967
## EthnicityWhite                                          8.291e+03   2.524
## IncomeLevel>$150k                                       8.371e+03   2.627
## IncomeLevel$100-150k                                    8.322e+03   2.834
## IncomeLevel$20-50k                                      8.379e+03   1.526
## IncomeLevel$50-100k                                     8.375e+03   4.105
## BMI                                                     8.345e+03  -2.593
## CESD.10baseline                                         8.375e+03  -3.348
## SmokingStatusFormer Smoker                              8.393e+03   1.330
## SmokingStatusNever Smoked                               8.392e+03   2.027
## SmokingStatusOccasional Smoker                          8.265e+03  -0.109
## RelationshipstatusMarried                               8.393e+03   2.804
## RelationshipstatusSeparated                             8.461e+03   1.065
## RelationshipstatusSingle                                8.382e+03   1.234
## RelationshipstatusWidowed                               8.398e+03   0.115
## LivingstatusAssisted Living                             8.435e+03  -1.823
## LivingstatusHouse                                       8.374e+03   0.430
## LivingstatusOther                                       8.287e+03  -0.949
## AnxietyYes                                              8.368e+03   0.498
## MoodDisordYes                                           8.367e+03  -1.672
## Chronicconditions                                       8.362e+03  -1.453
## PASE_Total                                              8.367e+03   4.924
## RVLT_Immediate_Normedbaseline                           8.388e+03  43.034
## timefactor2:PandemicFU2 data collected before COVID-19  8.230e+03  -0.972
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            1.01e-06 ***
## PandemicFU2 data collected before COVID-19             0.018254 *  
## Age                                                    0.000276 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.004991 ** 
## EducationLess than High School Diploma                 0.000184 ***
## EducationSome College                                  0.049221 *  
## EthnicityWhite                                         0.011623 *  
## IncomeLevel>$150k                                      0.008637 ** 
## IncomeLevel$100-150k                                   0.004601 ** 
## IncomeLevel$20-50k                                     0.127043    
## IncomeLevel$50-100k                                    4.08e-05 ***
## BMI                                                    0.009525 ** 
## CESD.10baseline                                        0.000817 ***
## SmokingStatusFormer Smoker                             0.183503    
## SmokingStatusNever Smoked                              0.042735 *  
## SmokingStatusOccasional Smoker                         0.913045    
## RelationshipstatusMarried                              0.005054 ** 
## RelationshipstatusSeparated                            0.286915    
## RelationshipstatusSingle                               0.217165    
## RelationshipstatusWidowed                              0.908794    
## LivingstatusAssisted Living                            0.068413 .  
## LivingstatusHouse                                      0.667408    
## LivingstatusOther                                      0.342513    
## AnxietyYes                                             0.618158    
## MoodDisordYes                                          0.094596 .  
## Chronicconditions                                      0.146264    
## PASE_Total                                             8.63e-07 ***
## RVLT_Immediate_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.331232    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

10.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.4 0.208 Inf      10.0      10.8
##  FU2 data collected before COVID-19   10.6 0.208 Inf      10.2      11.0
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.7 0.208 Inf      10.3      11.1
##  FU2 data collected before COVID-19   10.8 0.208 Inf      10.4      11.2
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_adj10, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.1794 0.0760 Inf  -2.361  0.0182
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0963 0.0766 Inf  -1.257  0.2086
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_adj10, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.1794 0.0760 Inf    -0.328   -0.0304
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0963 0.0766 Inf    -0.246    0.0538
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

10.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_adj10 <- summary(lsmeans(modelRVLT_imm_adj10, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_adj10$Time<-NA
RVLTimmediate_lsmeans_adj10$Time[RVLTimmediate_lsmeans_adj10$timefactor==1]<-"Follow-up 1"
RVLTimmediate_lsmeans_adj10$Time[RVLTimmediate_lsmeans_adj10$timefactor==2]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_adj10, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

10.1.4) Planned contrasts

lsmeans.RVLTImm10 <- lsmeans(modelRVLT_imm_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16420' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16420)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm10,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   0.0831 0.0855 Inf   0.972
##  p.value
##   0.3312
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

10.2) RVLT Delayed Recall

10.2.1) Model

modelRVLT_del_adj10<- lmer(RVLT_Delayed_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + RVLT_Delayed_Normedbaseline +
                            (1|ID), data= Tracking.data_long_2)
summary(modelRVLT_del_adj10)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + RVLT_Delayed_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 84249.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8988 -0.5550 -0.0364  0.5114  4.0165 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.115    2.029   
##  Residual             6.942    2.635   
## Number of obs: 16282, groups:  ID, 8435
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             6.568e+00  4.255e-01
## timefactor2                                             5.852e-01  6.217e-02
## PandemicFU2 data collected before COVID-19              2.664e-01  7.498e-02
## Age                                                    -6.290e-03  4.024e-03
## SexM                                                   -5.303e-01  6.846e-02
## EducationHigh School Diploma                            2.956e-01  9.617e-02
## EducationLess than High School Diploma                  3.886e-01  1.367e-01
## EducationSome College                                   3.012e-01  1.194e-01
## EthnicityWhite                                          7.048e-01  1.916e-01
## IncomeLevel>$150k                                       4.192e-01  1.785e-01
## IncomeLevel$100-150k                                    3.324e-01  1.426e-01
## IncomeLevel$20-50k                                      1.598e-01  9.505e-02
## IncomeLevel$50-100k                                     4.515e-01  1.024e-01
## BMI                                                    -1.834e-02  6.446e-03
## CESD.10baseline                                        -2.162e-02  7.687e-03
## SmokingStatusFormer Smoker                              9.409e-02  1.308e-01
## SmokingStatusNever Smoked                               2.694e-01  1.361e-01
## SmokingStatusOccasional Smoker                          6.592e-02  2.578e-01
## RelationshipstatusMarried                               8.316e-02  1.118e-01
## RelationshipstatusSeparated                            -5.816e-02  2.203e-01
## RelationshipstatusSingle                                2.294e-02  1.508e-01
## RelationshipstatusWidowed                              -1.445e-01  1.526e-01
## LivingstatusAssisted Living                            -1.047e+00  4.534e-01
## LivingstatusHouse                                       1.008e-01  1.007e-01
## LivingstatusOther                                      -2.094e-01  3.751e-01
## AnxietyYes                                              1.046e-01  1.341e-01
## MoodDisordYes                                          -1.729e-01  9.725e-02
## Chronicconditions                                      -3.090e-02  1.573e-02
## PASE_Total                                              2.308e-03  4.584e-04
## RVLT_Delayed_Normedbaseline                             3.921e-01  8.304e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -2.805e-01  8.362e-02
##                                                                df t value
## (Intercept)                                             8.471e+03  15.437
## timefactor2                                             8.230e+03   9.413
## PandemicFU2 data collected before COVID-19              1.430e+04   3.553
## Age                                                     8.386e+03  -1.563
## SexM                                                    8.357e+03  -7.746
## EducationHigh School Diploma                            8.359e+03   3.074
## EducationLess than High School Diploma                  8.552e+03   2.843
## EducationSome College                                   8.276e+03   2.523
## EthnicityWhite                                          8.393e+03   3.678
## IncomeLevel>$150k                                       8.347e+03   2.348
## IncomeLevel$100-150k                                    8.319e+03   2.331
## IncomeLevel$20-50k                                      8.379e+03   1.681
## IncomeLevel$50-100k                                     8.359e+03   4.409
## BMI                                                     8.319e+03  -2.844
## CESD.10baseline                                         8.388e+03  -2.813
## SmokingStatusFormer Smoker                              8.369e+03   0.719
## SmokingStatusNever Smoked                               8.366e+03   1.979
## SmokingStatusOccasional Smoker                          8.288e+03   0.256
## RelationshipstatusMarried                               8.349e+03   0.744
## RelationshipstatusSeparated                             8.470e+03  -0.264
## RelationshipstatusSingle                                8.335e+03   0.152
## RelationshipstatusWidowed                               8.369e+03  -0.947
## LivingstatusAssisted Living                             8.465e+03  -2.308
## LivingstatusHouse                                       8.376e+03   1.001
## LivingstatusOther                                       8.341e+03  -0.558
## AnxietyYes                                              8.338e+03   0.780
## MoodDisordYes                                           8.344e+03  -1.778
## Chronicconditions                                       8.348e+03  -1.964
## PASE_Total                                              8.358e+03   5.034
## RVLT_Delayed_Normedbaseline                             8.363e+03  47.224
## timefactor2:PandemicFU2 data collected before COVID-19  8.170e+03  -3.355
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             0.000382 ***
## Age                                                    0.118036    
## SexM                                                   1.06e-14 ***
## EducationHigh School Diploma                           0.002121 ** 
## EducationLess than High School Diploma                 0.004482 ** 
## EducationSome College                                  0.011644 *  
## EthnicityWhite                                         0.000237 ***
## IncomeLevel>$150k                                      0.018884 *  
## IncomeLevel$100-150k                                   0.019797 *  
## IncomeLevel$20-50k                                     0.092806 .  
## IncomeLevel$50-100k                                    1.05e-05 ***
## BMI                                                    0.004460 ** 
## CESD.10baseline                                        0.004917 ** 
## SmokingStatusFormer Smoker                             0.472075    
## SmokingStatusNever Smoked                              0.047843 *  
## SmokingStatusOccasional Smoker                         0.798193    
## RelationshipstatusMarried                              0.456884    
## RelationshipstatusSeparated                            0.791753    
## RelationshipstatusSingle                               0.879086    
## RelationshipstatusWidowed                              0.343720    
## LivingstatusAssisted Living                            0.020999 *  
## LivingstatusHouse                                      0.316968    
## LivingstatusOther                                      0.576638    
## AnxietyYes                                             0.435501    
## MoodDisordYes                                          0.075487 .  
## Chronicconditions                                      0.049550 *  
## PASE_Total                                             4.89e-07 ***
## RVLT_Delayed_Normedbaseline                             < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.000798 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

10.2.2) Estimated marginal means

lsmeans(modelRVLT_del_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.5 0.206 Inf      10.1      10.9
##  FU2 data collected before COVID-19   10.8 0.206 Inf      10.3      11.2
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.1 0.206 Inf      10.7      11.5
##  FU2 data collected before COVID-19   11.1 0.206 Inf      10.7      11.5
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_adj10, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.2664 0.0750 Inf  -3.553  0.0004
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0141 0.0755 Inf   0.187  0.8516
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_adj10, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.2664 0.0750 Inf    -0.413    -0.119
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0141 0.0755 Inf    -0.134     0.162
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

10.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_adj10 <- summary(lsmeans(modelRVLT_del_adj10, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_adj10$Time<-NA
RVLTdelayed_lsmeans_adj10$Time[RVLTdelayed_lsmeans_adj10$timefactor==1]<-"Follow-up 1"
RVLTdelayed_lsmeans_adj10$Time[RVLTdelayed_lsmeans_adj10$timefactor==2]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_adj10, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

10.2.4) Planned contrasts

lsmeans.RVLTDel10 <- lsmeans(modelRVLT_del_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16282' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16282)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel10,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))    0.281 0.0836 Inf   3.355
##  p.value
##   0.0008
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

10.3) Mental Alteration Test

10.3.1) Model

modelMAT_adj10<- lmer(MAT_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + MAT_Normedbaseline +
                      (1|ID), data= Tracking.data_long_2)
summary(modelMAT_adj10)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + MAT_Normedbaseline + (1 |      ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 79636.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4748 -0.5205 -0.0783  0.3697  4.9556 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.353    1.534   
##  Residual             8.304    2.882   
## Number of obs: 15353, groups:  ID, 8344
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.636e+00  4.088e-01
## timefactor2                                            -1.365e+00  7.034e-02
## PandemicFU2 data collected before COVID-19             -4.697e-01  7.582e-02
## Age                                                    -1.255e-02  3.827e-03
## SexM                                                   -1.093e+00  6.501e-02
## EducationHigh School Diploma                            3.828e-03  9.152e-02
## EducationLess than High School Diploma                 -5.448e-02  1.317e-01
## EducationSome College                                  -8.197e-02  1.129e-01
## EthnicityWhite                                          8.887e-01  1.833e-01
## IncomeLevel>$150k                                       2.230e-01  1.699e-01
## IncomeLevel$100-150k                                    2.581e-01  1.356e-01
## IncomeLevel$20-50k                                      1.562e-01  9.074e-02
## IncomeLevel$50-100k                                     1.873e-01  9.781e-02
## BMI                                                    -1.367e-02  6.105e-03
## CESD.10baseline                                        -1.840e-02  7.302e-03
## SmokingStatusFormer Smoker                              9.113e-02  1.241e-01
## SmokingStatusNever Smoked                               1.816e-02  1.291e-01
## SmokingStatusOccasional Smoker                          1.809e-01  2.445e-01
## RelationshipstatusMarried                               2.547e-02  1.064e-01
## RelationshipstatusSeparated                            -5.661e-02  2.089e-01
## RelationshipstatusSingle                                5.263e-01  1.434e-01
## RelationshipstatusWidowed                              -8.460e-02  1.459e-01
## LivingstatusAssisted Living                            -3.059e-01  4.319e-01
## LivingstatusHouse                                      -2.065e-01  9.608e-02
## LivingstatusOther                                      -3.766e-01  3.588e-01
## AnxietyYes                                              6.174e-02  1.271e-01
## MoodDisordYes                                           1.262e-01  9.213e-02
## Chronicconditions                                      -3.402e-02  1.503e-02
## PASE_Total                                             -6.223e-04  4.339e-04
## MAT_Normedbaseline                                      4.490e-01  8.549e-03
## timefactor2:PandemicFU2 data collected before COVID-19  5.097e-01  9.449e-02
##                                                                df t value
## (Intercept)                                             8.221e+03  18.676
## timefactor2                                             7.889e+03 -19.411
## PandemicFU2 data collected before COVID-19              1.472e+04  -6.195
## Age                                                     8.180e+03  -3.278
## SexM                                                    8.078e+03 -16.805
## EducationHigh School Diploma                            8.077e+03   0.042
## EducationLess than High School Diploma                  8.326e+03  -0.414
## EducationSome College                                   7.966e+03  -0.726
## EthnicityWhite                                          8.203e+03   4.849
## IncomeLevel>$150k                                       8.064e+03   1.313
## IncomeLevel$100-150k                                    8.039e+03   1.903
## IncomeLevel$20-50k                                      8.141e+03   1.722
## IncomeLevel$50-100k                                     8.095e+03   1.915
## BMI                                                     7.968e+03  -2.239
## CESD.10baseline                                         8.039e+03  -2.520
## SmokingStatusFormer Smoker                              8.022e+03   0.735
## SmokingStatusNever Smoked                               8.023e+03   0.141
## SmokingStatusOccasional Smoker                          7.892e+03   0.740
## RelationshipstatusMarried                               8.133e+03   0.239
## RelationshipstatusSeparated                             8.186e+03  -0.271
## RelationshipstatusSingle                                8.103e+03   3.670
## RelationshipstatusWidowed                               8.186e+03  -0.580
## LivingstatusAssisted Living                             8.064e+03  -0.708
## LivingstatusHouse                                       8.146e+03  -2.150
## LivingstatusOther                                       8.143e+03  -1.049
## AnxietyYes                                              8.045e+03   0.486
## MoodDisordYes                                           8.017e+03   1.370
## Chronicconditions                                       8.136e+03  -2.264
## PASE_Total                                              8.031e+03  -1.434
## MAT_Normedbaseline                                      8.135e+03  52.521
## timefactor2:PandemicFU2 data collected before COVID-19  7.827e+03   5.394
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             5.97e-10 ***
## Age                                                    0.001048 ** 
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.966640    
## EducationLess than High School Diploma                 0.679223    
## EducationSome College                                  0.467668    
## EthnicityWhite                                         1.26e-06 ***
## IncomeLevel>$150k                                      0.189326    
## IncomeLevel$100-150k                                   0.057013 .  
## IncomeLevel$20-50k                                     0.085189 .  
## IncomeLevel$50-100k                                    0.055552 .  
## BMI                                                    0.025155 *  
## CESD.10baseline                                        0.011742 *  
## SmokingStatusFormer Smoker                             0.462610    
## SmokingStatusNever Smoked                              0.888127    
## SmokingStatusOccasional Smoker                         0.459449    
## RelationshipstatusMarried                              0.810900    
## RelationshipstatusSeparated                            0.786349    
## RelationshipstatusSingle                               0.000244 ***
## RelationshipstatusWidowed                              0.562045    
## LivingstatusAssisted Living                            0.478757    
## LivingstatusHouse                                      0.031622 *  
## LivingstatusOther                                      0.293997    
## AnxietyYes                                             0.627040    
## MoodDisordYes                                          0.170674    
## Chronicconditions                                      0.023595 *  
## PASE_Total                                             0.151566    
## MAT_Normedbaseline                                      < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 7.08e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

10.3.2) Estimated marginal means

lsmeans(modelMAT_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.81 0.198 Inf     10.42     11.19
##  FU2 data collected before COVID-19  10.34 0.198 Inf      9.95     10.72
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.44 0.198 Inf      9.05      9.83
##  FU2 data collected before COVID-19   9.48 0.197 Inf      9.09      9.87
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_adj10, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##      0.47 0.0758 Inf   6.195  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##     -0.04 0.0762 Inf  -0.525  0.5993
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_adj10, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##      0.47 0.0758 Inf     0.321     0.618
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##     -0.04 0.0762 Inf    -0.189     0.109
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

10.3.3) Graph of estimated marginal means

MAT_lsmeans_adj10 <- summary(lsmeans(modelMAT_adj10, ~Pandemic|timefactor))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_adj10$Time<-NA
MAT_lsmeans_adj10$Time[MAT_lsmeans_adj10$timefactor==1]<-"Follow-up 1"
MAT_lsmeans_adj10$Time[MAT_lsmeans_adj10$timefactor==2]<-"Follow-up 2"
ggplot(MAT_lsmeans_adj10, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

10.3.4) Planned contrasts

lsmeans.MAT10 <- lsmeans(modelMAT_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15353' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15353)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT10,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))    -0.51 0.0945 Inf  -5.394
##  p.value
##   <.0001
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

10.4) Animal Fluency

10.4.1) Model

modelAnimals_adj10<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + Animal_Fluency_Normedbaseline +
                           (1|ID), data= Tracking.data_long_2)
summary(modelAnimals_adj10)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + Animal_Fluency_Normedbaseline +  
##     (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 73835.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8973 -0.5565 -0.0188  0.5329  4.7771 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.379    1.543   
##  Residual             3.191    1.786   
## Number of obs: 16543, groups:  ID, 8454
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             5.080e+00  3.085e-01
## timefactor2                                             9.181e-02  4.176e-02
## PandemicFU2 data collected before COVID-19              1.678e-01  5.281e-02
## Age                                                    -1.415e-02  2.875e-03
## SexM                                                   -1.683e-01  4.917e-02
## EducationHigh School Diploma                            2.332e-01  6.923e-02
## EducationLess than High School Diploma                  1.463e-01  9.784e-02
## EducationSome College                                   1.784e-01  8.597e-02
## EthnicityWhite                                          4.594e-01  1.374e-01
## IncomeLevel>$150k                                       3.605e-03  1.286e-01
## IncomeLevel$100-150k                                    4.776e-02  1.028e-01
## IncomeLevel$20-50k                                     -1.061e-01  6.835e-02
## IncomeLevel$50-100k                                     6.691e-02  7.369e-02
## BMI                                                    -9.107e-03  4.640e-03
## CESD.10baseline                                        -1.015e-02  5.533e-03
## SmokingStatusFormer Smoker                              1.414e-01  9.422e-02
## SmokingStatusNever Smoked                               1.664e-01  9.802e-02
## SmokingStatusOccasional Smoker                         -2.532e-02  1.858e-01
## RelationshipstatusMarried                               4.729e-02  8.046e-02
## RelationshipstatusSeparated                             1.877e-01  1.583e-01
## RelationshipstatusSingle                                5.719e-02  1.086e-01
## RelationshipstatusWidowed                              -1.872e-02  1.096e-01
## LivingstatusAssisted Living                            -2.391e-01  3.253e-01
## LivingstatusHouse                                       1.539e-01  7.248e-02
## LivingstatusOther                                      -2.822e-01  2.687e-01
## AnxietyYes                                              1.026e-01  9.656e-02
## MoodDisordYes                                           7.169e-02  7.006e-02
## Chronicconditions                                      -1.343e-02  1.131e-02
## PASE_Total                                              4.653e-04  3.293e-04
## Animal_Fluency_Normedbaseline                           5.275e-01  7.168e-03
## timefactor2:PandemicFU2 data collected before COVID-19  2.120e-02  5.614e-02
##                                                                df t value
## (Intercept)                                             8.450e+03  16.465
## timefactor2                                             8.321e+03   2.199
## PandemicFU2 data collected before COVID-19              1.389e+04   3.178
## Age                                                     8.378e+03  -4.920
## SexM                                                    8.380e+03  -3.424
## EducationHigh School Diploma                            8.392e+03   3.369
## EducationLess than High School Diploma                  8.481e+03   1.496
## EducationSome College                                   8.339e+03   2.075
## EthnicityWhite                                          8.311e+03   3.343
## IncomeLevel>$150k                                       8.389e+03   0.028
## IncomeLevel$100-150k                                    8.350e+03   0.465
## IncomeLevel$20-50k                                      8.383e+03  -1.552
## IncomeLevel$50-100k                                     8.381e+03   0.908
## BMI                                                     8.357e+03  -1.963
## CESD.10baseline                                         8.397e+03  -1.835
## SmokingStatusFormer Smoker                              8.396e+03   1.501
## SmokingStatusNever Smoked                               8.393e+03   1.698
## SmokingStatusOccasional Smoker                          8.321e+03  -0.136
## RelationshipstatusMarried                               8.417e+03   0.588
## RelationshipstatusSeparated                             8.454e+03   1.186
## RelationshipstatusSingle                                8.408e+03   0.527
## RelationshipstatusWidowed                               8.387e+03  -0.171
## LivingstatusAssisted Living                             8.405e+03  -0.735
## LivingstatusHouse                                       8.399e+03   2.123
## LivingstatusOther                                       8.242e+03  -1.050
## AnxietyYes                                              8.369e+03   1.063
## MoodDisordYes                                           8.389e+03   1.023
## Chronicconditions                                       8.356e+03  -1.188
## PASE_Total                                              8.370e+03   1.413
## Animal_Fluency_Normedbaseline                           8.364e+03  73.588
## timefactor2:PandemicFU2 data collected before COVID-19  8.263e+03   0.378
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.027920 *  
## PandemicFU2 data collected before COVID-19             0.001484 ** 
## Age                                                    8.84e-07 ***
## SexM                                                   0.000620 ***
## EducationHigh School Diploma                           0.000758 ***
## EducationLess than High School Diploma                 0.134805    
## EducationSome College                                  0.038002 *  
## EthnicityWhite                                         0.000833 ***
## IncomeLevel>$150k                                      0.977631    
## IncomeLevel$100-150k                                   0.642151    
## IncomeLevel$20-50k                                     0.120713    
## IncomeLevel$50-100k                                    0.363888    
## BMI                                                    0.049706 *  
## CESD.10baseline                                        0.066550 .  
## SmokingStatusFormer Smoker                             0.133337    
## SmokingStatusNever Smoked                              0.089526 .  
## SmokingStatusOccasional Smoker                         0.891580    
## RelationshipstatusMarried                              0.556703    
## RelationshipstatusSeparated                            0.235684    
## RelationshipstatusSingle                               0.598337    
## RelationshipstatusWidowed                              0.864439    
## LivingstatusAssisted Living                            0.462495    
## LivingstatusHouse                                      0.033777 *  
## LivingstatusOther                                      0.293663    
## AnxietyYes                                             0.287883    
## MoodDisordYes                                          0.306261    
## Chronicconditions                                      0.235037    
## PASE_Total                                             0.157657    
## Animal_Fluency_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.705696    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

10.4.2) Estimated marginal means

lsmeans(modelAnimals_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.83 0.148 Inf      9.54      10.1
##  FU2 data collected before COVID-19  10.00 0.148 Inf      9.71      10.3
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.92 0.148 Inf      9.63      10.2
##  FU2 data collected before COVID-19  10.11 0.148 Inf      9.82      10.4
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_adj10, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.168 0.0528 Inf  -3.178  0.0015
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.189 0.0532 Inf  -3.553  0.0004
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_adj10, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.168 0.0528 Inf    -0.271   -0.0643
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.189 0.0532 Inf    -0.293   -0.0847
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

10.4.3) Graph of estimated marginal means

Animals_lsmeans_adj10 <- summary(lsmeans(modelAnimals_adj10, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_adj10$Time<-NA
Animals_lsmeans_adj10$Time[Animals_lsmeans_adj10$timefactor==1]<-"Follow-up 1"
Animals_lsmeans_adj10$Time[Animals_lsmeans_adj10$timefactor==2]<-"Follow-up 2"
ggplot(Animals_lsmeans_adj10, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

10.3.4) Planned contrasts

lsmeans.Animals10 <- lsmeans(modelAnimals_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16543' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16543)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals10,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))  -0.0212 0.0561 Inf  -0.378
##  p.value
##   0.7057
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

10.5) Global cognition composite score

10.5.1) Model

modelGlobal_adj10<- lmer(Global_Composite ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + Global_Compositebaseline +
                       (1|ID), data= Tracking.data_long_2)
summary(modelGlobal_adj10)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + Global_Compositebaseline +      (1 | ID)
##    Data: Tracking.data_long_2
## 
## REML criterion at convergence: 69674.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3579 -0.5418 -0.0472  0.5077  3.6727 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.454    1.567   
##  Residual             3.926    1.981   
## Number of obs: 15062, groups:  ID, 8303
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.474e+00  3.318e-01
## timefactor2                                            -8.265e-02  4.933e-02
## PandemicFU2 data collected before COVID-19             -1.911e-02  5.918e-02
## Age                                                    -1.677e-02  3.170e-03
## SexM                                                   -6.469e-01  5.375e-02
## EducationHigh School Diploma                            2.265e-01  7.533e-02
## EducationLess than High School Diploma                  2.587e-01  1.088e-01
## EducationSome College                                   9.571e-02  9.322e-02
## EthnicityWhite                                          7.442e-01  1.511e-01
## IncomeLevel>$150k                                       3.113e-01  1.399e-01
## IncomeLevel$100-150k                                    2.728e-01  1.116e-01
## IncomeLevel$20-50k                                      1.423e-01  7.464e-02
## IncomeLevel$50-100k                                     3.165e-01  8.042e-02
## BMI                                                    -1.797e-02  5.034e-03
## CESD.10baseline                                        -2.010e-02  6.027e-03
## SmokingStatusFormer Smoker                              1.508e-01  1.023e-01
## SmokingStatusNever Smoked                               1.929e-01  1.064e-01
## SmokingStatusOccasional Smoker                          6.101e-02  2.019e-01
## RelationshipstatusMarried                               8.147e-02  8.769e-02
## RelationshipstatusSeparated                             7.316e-02  1.723e-01
## RelationshipstatusSingle                                2.792e-01  1.181e-01
## RelationshipstatusWidowed                              -1.275e-01  1.203e-01
## LivingstatusAssisted Living                            -5.596e-01  3.582e-01
## LivingstatusHouse                                       2.618e-02  7.907e-02
## LivingstatusOther                                      -2.473e-01  2.969e-01
## AnxietyYes                                              1.147e-01  1.047e-01
## MoodDisordYes                                          -4.224e-02  7.591e-02
## Chronicconditions                                      -2.233e-02  1.238e-02
## PASE_Total                                              1.169e-03  3.580e-04
## Global_Compositebaseline                                5.425e-01  7.693e-03
## timefactor2:PandemicFU2 data collected before COVID-19  1.133e-03  6.628e-02
##                                                                df t value
## (Intercept)                                             8.262e+03   4.444
## timefactor2                                             7.628e+03  -1.675
## PandemicFU2 data collected before COVID-19              1.363e+04  -0.323
## Age                                                     8.252e+03  -5.290
## SexM                                                    8.148e+03 -12.034
## EducationHigh School Diploma                            8.117e+03   3.007
## EducationLess than High School Diploma                  8.439e+03   2.377
## EducationSome College                                   8.024e+03   1.027
## EthnicityWhite                                          8.259e+03   4.926
## IncomeLevel>$150k                                       8.087e+03   2.225
## IncomeLevel$100-150k                                    8.108e+03   2.444
## IncomeLevel$20-50k                                      8.187e+03   1.907
## IncomeLevel$50-100k                                     8.135e+03   3.936
## BMI                                                     8.046e+03  -3.570
## CESD.10baseline                                         8.141e+03  -3.334
## SmokingStatusFormer Smoker                              8.126e+03   1.474
## SmokingStatusNever Smoked                               8.124e+03   1.813
## SmokingStatusOccasional Smoker                          8.023e+03   0.302
## RelationshipstatusMarried                               8.164e+03   0.929
## RelationshipstatusSeparated                             8.279e+03   0.425
## RelationshipstatusSingle                                8.119e+03   2.365
## RelationshipstatusWidowed                               8.239e+03  -1.060
## LivingstatusAssisted Living                             8.034e+03  -1.562
## LivingstatusHouse                                       8.183e+03   0.331
## LivingstatusOther                                       8.166e+03  -0.833
## AnxietyYes                                              8.091e+03   1.095
## MoodDisordYes                                           8.068e+03  -0.557
## Chronicconditions                                       8.178e+03  -1.805
## PASE_Total                                              8.109e+03   3.265
## Global_Compositebaseline                                8.141e+03  70.517
## timefactor2:PandemicFU2 data collected before COVID-19  7.578e+03   0.017
##                                                        Pr(>|t|)    
## (Intercept)                                            8.96e-06 ***
## timefactor2                                            0.093886 .  
## PandemicFU2 data collected before COVID-19             0.746768    
## Age                                                    1.25e-07 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.002647 ** 
## EducationLess than High School Diploma                 0.017469 *  
## EducationSome College                                  0.304587    
## EthnicityWhite                                         8.56e-07 ***
## IncomeLevel>$150k                                      0.026126 *  
## IncomeLevel$100-150k                                   0.014561 *  
## IncomeLevel$20-50k                                     0.056543 .  
## IncomeLevel$50-100k                                    8.36e-05 ***
## BMI                                                    0.000359 ***
## CESD.10baseline                                        0.000859 ***
## SmokingStatusFormer Smoker                             0.140444    
## SmokingStatusNever Smoked                              0.069891 .  
## SmokingStatusOccasional Smoker                         0.762466    
## RelationshipstatusMarried                              0.352915    
## RelationshipstatusSeparated                            0.671094    
## RelationshipstatusSingle                               0.018064 *  
## RelationshipstatusWidowed                              0.289127    
## LivingstatusAssisted Living                            0.118267    
## LivingstatusHouse                                      0.740582    
## LivingstatusOther                                      0.404850    
## AnxietyYes                                             0.273496    
## MoodDisordYes                                          0.577872    
## Chronicconditions                                      0.071174 .  
## PASE_Total                                             0.001098 ** 
## Global_Compositebaseline                                < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.986362    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

10.5.2) Estimated marginal means

lsmeans(modelGlobal_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.737 0.163 Inf     0.418     1.056
##  FU2 data collected before COVID-19  0.718 0.163 Inf     0.399     1.037
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.654 0.163 Inf     0.336     0.973
##  FU2 data collected before COVID-19  0.636 0.162 Inf     0.318     0.955
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_adj10, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0191 0.0592 Inf   0.323  0.7468
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    0.0180 0.0593 Inf   0.303  0.7617
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_adj10, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0191 0.0592 Inf   -0.0969     0.135
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    0.0180 0.0593 Inf   -0.0982     0.134
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

10.5.3) Graph of estimated marginal means

Global_lsmeans_adj10 <- summary(lsmeans(modelGlobal_adj10, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_adj10$Time<-NA
Global_lsmeans_adj10$Time[Global_lsmeans_adj10$timefactor==1]<-"Follow-up 1"
Global_lsmeans_adj10$Time[Global_lsmeans_adj10$timefactor==2]<-"Follow-up 2"
ggplot(Global_lsmeans_adj10, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "Global Cognitive Composite Score Score", title = "Global Cognitive Composite Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

10.5.4) Planned contrasts

lsmeans.Global10 <- lsmeans(modelGlobal_adj10, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 15062' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 15062)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global10,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L)) -0.00113 0.0663 Inf  -0.017
##  p.value
##   0.9864
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11) Sensitivity Analyses

11.1) Truncated Sample Development

For this sensitivity analysis, we only include participants w/ data collected in 2019 onward (N=16,649)

startdate <- as.POSIXct("2019-01-01 00:00:00", tz = "EST")
truncated <- subset(Tracking.Adjusted_Final, timestamp>startdate)

Linear mixed model set-up

truncated.short<-truncated[c(1,4:12,14,15,18:21,13,140,141,28,57,86,30,59,88,23,52,80,26,55,84,91,108,125,95,112,129,99,116,133,
                                               103,120,137,92,109,126,96,113,130,100,117,134,104,121,138,105,122,139)]

truncated.short2<-rename(truncated.short, c("Age"="Age_0","Sex"="Sex_0","Ethnicity"="Ethnicity_0","Relationshipstatus"="Relationship_status_0",
                             "Education"="Education4_0", "IncomeLevel"="Income_Level_0", "Livingstatus"="Living_status_0", 
                             "Alcohol"="Alcohol_0", "SmokingStatus"="Smoking_Status_0","Anxiety"="Anxiety_0","MoodDisord"="Mood_Disord_0",
                             "Chronicconditions"="Chronic_conditions_0", "BMI"="BMI_0", "PASE_Total"="PASE_TOTAL_0"))

truncated.short3<-truncated.short2
truncated.short4<-truncated.short2[c(1:19,20,23,26,29,32,35,38,41,44,47,50,53,56,21,22,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46,
                                     48,49,51,52,54,55,57,58)]
colnames(truncated.short3) <- (gsub("_2",".3",colnames(truncated.short3)))
colnames(truncated.short3) <- (gsub("_1",".2",colnames(truncated.short3)))
colnames(truncated.short3) <- (gsub("_0",".1",colnames(truncated.short3)))

colnames(truncated.short4) <- (gsub("_2",".2",colnames(truncated.short4)))
colnames(truncated.short4) <- (gsub("_1",".1",colnames(truncated.short4)))
colnames(truncated.short4) <- (gsub("_0","baseline",colnames(truncated.short4)))


truncated.data_long <- reshape(as.data.frame(truncated.short3),idvar="ID",varying=20:58,direction="long",sep=".") #reshape data into long format (3 timepoints)
truncated.data_long_2 <- reshape(as.data.frame(truncated.short4),idvar="ID",varying=33:58,direction="long",sep=".") #reshape data into long format (3 timepoints)

Indexed time as a categorical factor

#Treat time as a fixed effect
truncated.data_long$timefactor<-as.factor(truncated.data_long$time)
truncated.data_long_2$timefactor<-as.factor(truncated.data_long_2$time)

11.2) Truncated Sample Characteristics

Truncated full sample (N= 16,649)

Baseline<-dput(names(truncated[c(5,4,14,12,6,7,8,9,10,11,15,18,19,20,13,28,30,26,23)]))
## c("Age_0", "Sex_0", "BMI_0", "Ethnicity_0", "Relationship_status_0", 
## "Education4_0", "Income_Level_0", "Living_status_0", "Alcohol_0", 
## "Smoking_Status_0", "CESD_10_0", "Anxiety_0", "Mood_Disord_0", 
## "Pet_Owner_0", "PASE_TOTAL_0", "RVLT_Immediate_Score_0", "RVLT_Delayed_Score_0", 
## "MAT_Score_0", "Animal_Fluency_Strict_0")
Table1_truncated<-CreateTableOne(vars=Baseline, data=truncated)
print(Table1_truncated,contDigits=2,missing=TRUE,quote=TRUE)
##                                               ""
##  ""                                            "Overall"        "Missing"
##   "n"                                          "  9423"         "    "   
##   "Age_0 (mean (SD))"                          " 61.17 (10.22)" " 0.0"   
##   "Sex_0 = M (%)"                              "  4624 (49.1) " " 0.0"   
##   "BMI_0 (mean (SD))"                          " 27.48 (5.05)"  " 0.5"   
##   "Ethnicity_0 = White (%)"                    "  9165 (97.3) " " 0.0"   
##   "Relationship_status_0 (%)"                  "  "             " 0.0"   
##   "   Divorced"                                "   813 ( 8.6) " "    "   
##   "   Married"                                 "  6900 (73.3) " "    "   
##   "   Separated"                               "   246 ( 2.6) " "    "   
##   "   Single"                                  "   694 ( 7.4) " "    "   
##   "   Widowed"                                 "   766 ( 8.1) " "    "   
##   "Education4_0 (%)"                           "  "             " 0.0"   
##   "   College Degree or Higher"                "  6879 (73.0) " "    "   
##   "   High School Diploma"                     "  1213 (12.9) " "    "   
##   "   Less than High School Diploma"           "   626 ( 6.6) " "    "   
##   "   Some College"                            "   705 ( 7.5) " "    "   
##   "Income_Level_0 (%)"                         "  "             " 3.6"   
##   "   <$20k"                                   "  1449 (16.0) " "    "   
##   "   >$150k"                                  "   380 ( 4.2) " "    "   
##   "   $100-150k"                               "   715 ( 7.9) " "    "   
##   "   $20-50k"                                 "  3534 (38.9) " "    "   
##   "   $50-100k"                                "  3004 (33.1) " "    "   
##   "Living_status_0 (%)"                        "  "             " 0.0"   
##   "   Apartment/Condo/Townhome"                "  1063 (11.3) " "    "   
##   "   Assisted Living"                         "    48 ( 0.5) " "    "   
##   "   House"                                   "  8233 (87.4) " "    "   
##   "   Other"                                   "    79 ( 0.8) " "    "   
##   "Alcohol_0 (%)"                              "  "             " 3.0"   
##   "   Non-drinker"                             "   929 (10.2) " "    "   
##   "   Occasional drinker"                      "  1439 (15.7) " "    "   
##   "   Regular drinker (at least once a month)" "  6773 (74.1) " "    "   
##   "Smoking_Status_0 (%)"                       "  "             " 0.5"   
##   "   Daily Smoker"                            "   628 ( 6.7) " "    "   
##   "   Former Smoker"                           "  5667 (60.4) " "    "   
##   "   Never Smoked"                            "  2927 (31.2) " "    "   
##   "   Occasional Smoker"                       "   156 ( 1.7) " "    "   
##   "CESD_10_0 (mean (SD))"                      "  4.97 (4.37)"  " 0.3"   
##   "Anxiety_0 = Yes (%)"                        "   598 ( 6.4) " " 0.1"   
##   "Mood_Disord_0 = Yes (%)"                    "  1266 (13.4) " " 0.1"   
##   "Pet_Owner_0 = Yes (%)"                      "  4526 (48.2) " " 0.4"   
##   "PASE_TOTAL_0 (mean (SD))"                   "172.78 (79.33)" "19.2"   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  6.15 (2.25)"  " 0.0"   
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.57 (2.49)"  " 0.0"   
##   "MAT_Score_0 (mean (SD))"                    " 27.23 (9.14)"  " 0.0"   
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.46 (5.72)"  " 0.0"

Final baseline sample stratified by whether FU2 data was collected before (N= 7132) or after (N= 6898) the start of the COVID-19 pandemic

Table1_truncated_stratify<-CreateTableOne(vars=Baseline, strata="Pandemic", data=truncated)
print(Table1_truncated_stratify,contDigits=2,missing=TRUE,quote=TRUE)
##                                               "Stratified by Pandemic"
##  ""                                            "FU2 data collected after COVID-19"
##   "n"                                          "  5181"                           
##   "Age_0 (mean (SD))"                          " 60.29 (10.54)"                   
##   "Sex_0 = M (%)"                              "  2856 (55.1) "                   
##   "BMI_0 (mean (SD))"                          " 27.52 (4.94)"                    
##   "Ethnicity_0 = White (%)"                    "  5025 (97.0) "                   
##   "Relationship_status_0 (%)"                  "  "                               
##   "   Divorced"                                "   408 ( 7.9) "                   
##   "   Married"                                 "  3841 (74.2) "                   
##   "   Separated"                               "   150 ( 2.9) "                   
##   "   Single"                                  "   383 ( 7.4) "                   
##   "   Widowed"                                 "   397 ( 7.7) "                   
##   "Education4_0 (%)"                           "  "                               
##   "   College Degree or Higher"                "  3605 (69.6) "                   
##   "   High School Diploma"                     "   776 (15.0) "                   
##   "   Less than High School Diploma"           "   411 ( 7.9) "                   
##   "   Some College"                            "   389 ( 7.5) "                   
##   "Income_Level_0 (%)"                         "  "                               
##   "   <$20k"                                   "   783 (15.6) "                   
##   "   >$150k"                                  "   239 ( 4.8) "                   
##   "   $100-150k"                               "   426 ( 8.5) "                   
##   "   $20-50k"                                 "  1874 (37.3) "                   
##   "   $50-100k"                                "  1700 (33.9) "                   
##   "Living_status_0 (%)"                        "  "                               
##   "   Apartment/Condo/Townhome"                "   579 (11.2) "                   
##   "   Assisted Living"                         "    24 ( 0.5) "                   
##   "   House"                                   "  4541 (87.6) "                   
##   "   Other"                                   "    37 ( 0.7) "                   
##   "Alcohol_0 (%)"                              "  "                               
##   "   Non-drinker"                             "   512 (10.2) "                   
##   "   Occasional drinker"                      "   784 (15.6) "                   
##   "   Regular drinker (at least once a month)" "  3731 (74.2) "                   
##   "Smoking_Status_0 (%)"                       "  "                               
##   "   Daily Smoker"                            "   361 ( 7.0) "                   
##   "   Former Smoker"                           "  3128 (60.6) "                   
##   "   Never Smoked"                            "  1579 (30.6) "                   
##   "   Occasional Smoker"                       "    90 ( 1.7) "                   
##   "CESD_10_0 (mean (SD))"                      "  5.08 (4.47)"                    
##   "Anxiety_0 = Yes (%)"                        "   335 ( 6.5) "                   
##   "Mood_Disord_0 = Yes (%)"                    "   698 (13.5) "                   
##   "Pet_Owner_0 = Yes (%)"                      "  2562 (49.6) "                   
##   "PASE_TOTAL_0 (mean (SD))"                   "179.56 (81.39)"                   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  5.98 (2.20)"                    
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.42 (2.43)"                    
##   "MAT_Score_0 (mean (SD))"                    " 27.11 (9.20)"                    
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.28 (5.74)"                    
##                                               "Stratified by Pandemic"
##  ""                                            "FU2 data collected before COVID-19"
##   "n"                                          "  4242"                            
##   "Age_0 (mean (SD))"                          " 62.24 (9.72)"                     
##   "Sex_0 = M (%)"                              "  1768 (41.7) "                    
##   "BMI_0 (mean (SD))"                          " 27.43 (5.19)"                     
##   "Ethnicity_0 = White (%)"                    "  4140 (97.6) "                    
##   "Relationship_status_0 (%)"                  "  "                                
##   "   Divorced"                                "   405 ( 9.6) "                    
##   "   Married"                                 "  3059 (72.1) "                    
##   "   Separated"                               "    96 ( 2.3) "                    
##   "   Single"                                  "   311 ( 7.3) "                    
##   "   Widowed"                                 "   369 ( 8.7) "                    
##   "Education4_0 (%)"                           "  "                                
##   "   College Degree or Higher"                "  3274 (77.2) "                    
##   "   High School Diploma"                     "   437 (10.3) "                    
##   "   Less than High School Diploma"           "   215 ( 5.1) "                    
##   "   Some College"                            "   316 ( 7.4) "                    
##   "Income_Level_0 (%)"                         "  "                                
##   "   <$20k"                                   "   666 (16.4) "                    
##   "   >$150k"                                  "   141 ( 3.5) "                    
##   "   $100-150k"                               "   289 ( 7.1) "                    
##   "   $20-50k"                                 "  1660 (40.9) "                    
##   "   $50-100k"                                "  1304 (32.1) "                    
##   "Living_status_0 (%)"                        "  "                                
##   "   Apartment/Condo/Townhome"                "   484 (11.4) "                    
##   "   Assisted Living"                         "    24 ( 0.6) "                    
##   "   House"                                   "  3692 (87.0) "                    
##   "   Other"                                   "    42 ( 1.0) "                    
##   "Alcohol_0 (%)"                              "  "                                
##   "   Non-drinker"                             "   417 (10.1) "                    
##   "   Occasional drinker"                      "   655 (15.9) "                    
##   "   Regular drinker (at least once a month)" "  3042 (73.9) "                    
##   "Smoking_Status_0 (%)"                       "  "                                
##   "   Daily Smoker"                            "   267 ( 6.3) "                    
##   "   Former Smoker"                           "  2539 (60.2) "                    
##   "   Never Smoked"                            "  1348 (31.9) "                    
##   "   Occasional Smoker"                       "    66 ( 1.6) "                    
##   "CESD_10_0 (mean (SD))"                      "  4.83 (4.24)"                     
##   "Anxiety_0 = Yes (%)"                        "   263 ( 6.2) "                    
##   "Mood_Disord_0 = Yes (%)"                    "   568 (13.4) "                    
##   "Pet_Owner_0 = Yes (%)"                      "  1964 (46.5) "                    
##   "PASE_TOTAL_0 (mean (SD))"                   "164.63 (76.01)"                    
##   "RVLT_Immediate_Score_0 (mean (SD))"         "  6.35 (2.28)"                     
##   "RVLT_Delayed_Score_0 (mean (SD))"           "  4.76 (2.54)"                     
##   "MAT_Score_0 (mean (SD))"                    " 27.37 (9.06)"                     
##   "Animal_Fluency_Strict_0 (mean (SD))"        " 20.69 (5.70)"                     
##                                               "Stratified by Pandemic"
##  ""                                            "p"      "test" "Missing"
##   "n"                                          ""       ""     "    "   
##   "Age_0 (mean (SD))"                          "<0.001" ""     " 0.0"   
##   "Sex_0 = M (%)"                              "<0.001" ""     " 0.0"   
##   "BMI_0 (mean (SD))"                          " 0.378" ""     " 0.5"   
##   "Ethnicity_0 = White (%)"                    " 0.083" ""     " 0.0"   
##   "Relationship_status_0 (%)"                  " 0.004" ""     " 0.0"   
##   "   Divorced"                                ""       ""     "    "   
##   "   Married"                                 ""       ""     "    "   
##   "   Separated"                               ""       ""     "    "   
##   "   Single"                                  ""       ""     "    "   
##   "   Widowed"                                 ""       ""     "    "   
##   "Education4_0 (%)"                           "<0.001" ""     " 0.0"   
##   "   College Degree or Higher"                ""       ""     "    "   
##   "   High School Diploma"                     ""       ""     "    "   
##   "   Less than High School Diploma"           ""       ""     "    "   
##   "   Some College"                            ""       ""     "    "   
##   "Income_Level_0 (%)"                         "<0.001" ""     " 3.6"   
##   "   <$20k"                                   ""       ""     "    "   
##   "   >$150k"                                  ""       ""     "    "   
##   "   $100-150k"                               ""       ""     "    "   
##   "   $20-50k"                                 ""       ""     "    "   
##   "   $50-100k"                                ""       ""     "    "   
##   "Living_status_0 (%)"                        " 0.421" ""     " 0.0"   
##   "   Apartment/Condo/Townhome"                ""       ""     "    "   
##   "   Assisted Living"                         ""       ""     "    "   
##   "   House"                                   ""       ""     "    "   
##   "   Other"                                   ""       ""     "    "   
##   "Alcohol_0 (%)"                              " 0.914" ""     " 3.0"   
##   "   Non-drinker"                             ""       ""     "    "   
##   "   Occasional drinker"                      ""       ""     "    "   
##   "   Regular drinker (at least once a month)" ""       ""     "    "   
##   "Smoking_Status_0 (%)"                       " 0.331" ""     " 0.5"   
##   "   Daily Smoker"                            ""       ""     "    "   
##   "   Former Smoker"                           ""       ""     "    "   
##   "   Never Smoked"                            ""       ""     "    "   
##   "   Occasional Smoker"                       ""       ""     "    "   
##   "CESD_10_0 (mean (SD))"                      " 0.006" ""     " 0.3"   
##   "Anxiety_0 = Yes (%)"                        " 0.624" ""     " 0.1"   
##   "Mood_Disord_0 = Yes (%)"                    " 0.940" ""     " 0.1"   
##   "Pet_Owner_0 = Yes (%)"                      " 0.003" ""     " 0.4"   
##   "PASE_TOTAL_0 (mean (SD))"                   "<0.001" ""     "19.2"   
##   "RVLT_Immediate_Score_0 (mean (SD))"         "<0.001" ""     " 0.0"   
##   "RVLT_Delayed_Score_0 (mean (SD))"           "<0.001" ""     " 0.0"   
##   "MAT_Score_0 (mean (SD))"                    " 0.168" ""     " 0.0"   
##   "Animal_Fluency_Strict_0 (mean (SD))"        "<0.001" ""     " 0.0"

11.3) Full Adjusted Model: Time x Pandemic effects on cognition, physical activity, and sleep duration (not adjusting for baseline)

All models use normalized cognitive scores.Each model is adjusted for baseline age, sex, education, ethnicity, income level, baseline BMI, baseline CESD-10 score, smoking status, relationship status at baseline, living status at baseline, diagnosis of anxiety or mood disorder at baseline, number of chronic conditions at baseline, and baseline PASE score

11.3.1) RVLT Immediate Recall

11.3.1.1) Model

modelRVLT_imm_8_trun<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                         (1|ID), data= truncated.data_long)
summary(modelRVLT_imm_8_trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: truncated.data_long
## 
## REML criterion at convergence: 109191.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6122 -0.5799 -0.0477  0.5194  4.5803 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.212    2.283   
##  Residual             8.380    2.895   
## Number of obs: 20522, groups:  ID, 6987
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.893e+00  4.680e-01
## timefactor2                                             7.000e-01  6.657e-02
## timefactor3                                             1.013e+00  6.725e-02
## PandemicFU2 data collected before COVID-19              4.511e-01  8.995e-02
## Age                                                     1.556e-02  4.403e-03
## SexM                                                   -7.664e-01  7.666e-02
## EducationHigh School Diploma                            1.917e-01  1.076e-01
## EducationLess than High School Diploma                  6.156e-01  1.525e-01
## EducationSome College                                   2.297e-01  1.337e-01
## EthnicityWhite                                          1.219e+00  2.132e-01
## IncomeLevel>$150k                                       8.362e-01  1.968e-01
## IncomeLevel$100-150k                                    4.443e-01  1.599e-01
## IncomeLevel$20-50k                                      8.045e-02  1.078e-01
## IncomeLevel$50-100k                                     5.144e-01  1.159e-01
## BMI                                                    -1.805e-02  7.266e-03
## CESD.20.1                                              -3.680e-02  8.659e-03
## SmokingStatusFormer Smoker                              3.629e-01  1.467e-01
## SmokingStatusNever Smoked                               5.008e-01  1.526e-01
## SmokingStatusOccasional Smoker                          4.226e-01  2.895e-01
## RelationshipstatusMarried                               1.075e-01  1.260e-01
## RelationshipstatusSeparated                            -1.496e-01  2.440e-01
## RelationshipstatusSingle                               -4.828e-02  1.709e-01
## RelationshipstatusWidowed                              -6.016e-02  1.750e-01
## LivingstatusAssisted Living                            -3.970e-01  5.315e-01
## LivingstatusHouse                                       2.161e-02  1.150e-01
## LivingstatusOther                                      -5.238e-01  4.278e-01
## AnxietyYes                                             -4.922e-02  1.507e-01
## MoodDisordYes                                          -8.521e-02  1.087e-01
## Chronicconditions                                      -3.093e-02  1.776e-02
## PASE_Total                                              2.891e-03  5.101e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -1.758e-01  9.916e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -2.584e-01  9.967e-02
##                                                                df t value
## (Intercept)                                             7.013e+03  16.865
## timefactor2                                             1.358e+04  10.515
## timefactor3                                             1.366e+04  15.069
## PandemicFU2 data collected before COVID-19              1.554e+04   5.015
## Age                                                     6.928e+03   3.535
## SexM                                                    6.927e+03  -9.998
## EducationHigh School Diploma                            6.932e+03   1.781
## EducationLess than High School Diploma                  6.992e+03   4.037
## EducationSome College                                   6.898e+03   1.718
## EthnicityWhite                                          6.898e+03   5.719
## IncomeLevel>$150k                                       6.935e+03   4.249
## IncomeLevel$100-150k                                    6.909e+03   2.779
## IncomeLevel$20-50k                                      6.933e+03   0.747
## IncomeLevel$50-100k                                     6.932e+03   4.439
## BMI                                                     6.916e+03  -2.485
## CESD.20.1                                               6.925e+03  -4.250
## SmokingStatusFormer Smoker                              6.936e+03   2.474
## SmokingStatusNever Smoked                               6.936e+03   3.282
## SmokingStatusOccasional Smoker                          6.862e+03   1.460
## RelationshipstatusMarried                               6.935e+03   0.853
## RelationshipstatusSeparated                             6.965e+03  -0.613
## RelationshipstatusSingle                                6.935e+03  -0.283
## RelationshipstatusWidowed                               6.939e+03  -0.344
## LivingstatusAssisted Living                             6.931e+03  -0.747
## LivingstatusHouse                                       6.938e+03   0.188
## LivingstatusOther                                       6.855e+03  -1.224
## AnxietyYes                                              6.912e+03  -0.327
## MoodDisordYes                                           6.924e+03  -0.784
## Chronicconditions                                       6.920e+03  -1.741
## PASE_Total                                              6.920e+03   5.668
## timefactor2:PandemicFU2 data collected before COVID-19  1.358e+04  -1.773
## timefactor3:PandemicFU2 data collected before COVID-19  1.362e+04  -2.593
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             5.36e-07 ***
## Age                                                    0.000411 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.074885 .  
## EducationLess than High School Diploma                 5.47e-05 ***
## EducationSome College                                  0.085816 .  
## EthnicityWhite                                         1.12e-08 ***
## IncomeLevel>$150k                                      2.18e-05 ***
## IncomeLevel$100-150k                                   0.005468 ** 
## IncomeLevel$20-50k                                     0.455385    
## IncomeLevel$50-100k                                    9.18e-06 ***
## BMI                                                    0.012995 *  
## CESD.20.1                                              2.16e-05 ***
## SmokingStatusFormer Smoker                             0.013388 *  
## SmokingStatusNever Smoked                              0.001037 ** 
## SmokingStatusOccasional Smoker                         0.144423    
## RelationshipstatusMarried                              0.393545    
## RelationshipstatusSeparated                            0.539819    
## RelationshipstatusSingle                               0.777566    
## RelationshipstatusWidowed                              0.731066    
## LivingstatusAssisted Living                            0.455120    
## LivingstatusHouse                                      0.850865    
## LivingstatusOther                                      0.220882    
## AnxietyYes                                             0.743904    
## MoodDisordYes                                          0.432980    
## Chronicconditions                                      0.081681 .  
## PASE_Total                                             1.50e-08 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.076316 .  
## timefactor3:PandemicFU2 data collected before COVID-19 0.009525 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.3.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_8_trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.45 0.235 Inf      8.99      9.91
##  FU2 data collected before COVID-19   9.90 0.238 Inf      9.44     10.37
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.15 0.235 Inf      9.69     10.61
##  FU2 data collected before COVID-19  10.43 0.238 Inf      9.96     10.90
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.47 0.235 Inf     10.01     10.93
##  FU2 data collected before COVID-19  10.66 0.238 Inf     10.19     11.13
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_8_trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.451 0.0899 Inf  -5.015  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.275 0.0907 Inf  -3.035  0.0024
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.193 0.0913 Inf  -2.110  0.0349
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_8_trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.451 0.0899 Inf    -0.627   -0.2748
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.275 0.0907 Inf    -0.453   -0.0975
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.193 0.0913 Inf    -0.372   -0.0137
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.3.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_8trun <- summary(lsmeans(modelRVLT_imm_8_trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_8trun$Time<-NA
RVLTimmediate_lsmeans_8trun$Time[RVLTimmediate_lsmeans_8trun$timefactor==1]<-"Baseline"
RVLTimmediate_lsmeans_8trun$Time[RVLTimmediate_lsmeans_8trun$timefactor==2]<-"Follow-up 1"
RVLTimmediate_lsmeans_8trun$Time[RVLTimmediate_lsmeans_8trun$timefactor==3]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_8trun, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Immediate Score", title = "RVLT Immediate Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

11.3.1.4) Planned contrasts

lsmeans.RVLTImm8trun <- lsmeans(modelRVLT_imm_8_trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20522' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20522)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm8trun,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.1758 0.0992 Inf   1.773
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.0827 0.1004 Inf   0.824
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.2584 0.0997 Inf   2.593
##  p.value
##   0.0763
##   0.4101
##   0.0095
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.3.2) RVLT Delayed Recall

11.3.2.1) Model

modelRVLT_del_8trun<- lmer(RVLT_Delayed_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                        (1|ID), data= truncated.data_long)
summary(modelRVLT_del_8trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: truncated.data_long
## 
## REML criterion at convergence: 107532.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8255 -0.5652 -0.0365  0.5143  5.0735 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.571    2.360   
##  Residual             7.698    2.775   
## Number of obs: 20402, groups:  ID, 6987
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.850e+00  4.725e-01
## timefactor2                                             5.563e-01  6.405e-02
## timefactor3                                             1.143e+00  6.467e-02
## PandemicFU2 data collected before COVID-19              3.733e-01  8.893e-02
## Age                                                     2.642e-02  4.444e-03
## SexM                                                   -6.548e-01  7.735e-02
## EducationHigh School Diploma                            3.673e-01  1.086e-01
## EducationLess than High School Diploma                  5.761e-01  1.541e-01
## EducationSome College                                   3.710e-01  1.348e-01
## EthnicityWhite                                          1.110e+00  2.158e-01
## IncomeLevel>$150k                                       6.652e-01  1.985e-01
## IncomeLevel$100-150k                                    5.232e-01  1.613e-01
## IncomeLevel$20-50k                                      2.135e-01  1.088e-01
## IncomeLevel$50-100k                                     5.715e-01  1.169e-01
## BMI                                                    -1.843e-02  7.330e-03
## CESD.20.1                                              -3.674e-02  8.742e-03
## SmokingStatusFormer Smoker                              9.877e-02  1.480e-01
## SmokingStatusNever Smoked                               3.429e-01  1.539e-01
## SmokingStatusOccasional Smoker                          3.115e-01  2.924e-01
## RelationshipstatusMarried                              -4.107e-02  1.272e-01
## RelationshipstatusSeparated                            -1.311e-01  2.463e-01
## RelationshipstatusSingle                               -2.088e-01  1.724e-01
## RelationshipstatusWidowed                              -1.076e-01  1.767e-01
## LivingstatusAssisted Living                            -1.210e+00  5.368e-01
## LivingstatusHouse                                      -1.293e-03  1.160e-01
## LivingstatusOther                                      -2.917e-01  4.325e-01
## AnxietyYes                                             -2.939e-02  1.521e-01
## MoodDisordYes                                          -1.189e-01  1.096e-01
## Chronicconditions                                      -4.024e-02  1.792e-02
## PASE_Total                                              3.072e-03  5.148e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -6.747e-03  9.535e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -2.638e-01  9.580e-02
##                                                                df t value
## (Intercept)                                             7.027e+03  16.614
## timefactor2                                             1.350e+04   8.686
## timefactor3                                             1.356e+04  17.682
## PandemicFU2 data collected before COVID-19              1.482e+04   4.198
## Age                                                     6.939e+03   5.946
## SexM                                                    6.929e+03  -8.466
## EducationHigh School Diploma                            6.941e+03   3.383
## EducationLess than High School Diploma                  7.028e+03   3.738
## EducationSome College                                   6.891e+03   2.752
## EthnicityWhite                                          6.974e+03   5.146
## IncomeLevel>$150k                                       6.931e+03   3.351
## IncomeLevel$100-150k                                    6.913e+03   3.244
## IncomeLevel$20-50k                                      6.942e+03   1.963
## IncomeLevel$50-100k                                     6.935e+03   4.887
## BMI                                                     6.912e+03  -2.514
## CESD.20.1                                               6.941e+03  -4.203
## SmokingStatusFormer Smoker                              6.927e+03   0.668
## SmokingStatusNever Smoked                               6.928e+03   2.228
## SmokingStatusOccasional Smoker                          6.887e+03   1.065
## RelationshipstatusMarried                               6.946e+03  -0.323
## RelationshipstatusSeparated                             6.982e+03  -0.532
## RelationshipstatusSingle                                6.934e+03  -1.211
## RelationshipstatusWidowed                               6.950e+03  -0.609
## LivingstatusAssisted Living                             6.962e+03  -2.254
## LivingstatusHouse                                       6.952e+03  -0.011
## LivingstatusOther                                       6.903e+03  -0.674
## AnxietyYes                                              6.920e+03  -0.193
## MoodDisordYes                                           6.920e+03  -1.085
## Chronicconditions                                       6.923e+03  -2.245
## PASE_Total                                              6.931e+03   5.967
## timefactor2:PandemicFU2 data collected before COVID-19  1.349e+04  -0.071
## timefactor3:PandemicFU2 data collected before COVID-19  1.352e+04  -2.754
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             2.71e-05 ***
## Age                                                    2.89e-09 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.000722 ***
## EducationLess than High School Diploma                 0.000187 ***
## EducationSome College                                  0.005941 ** 
## EthnicityWhite                                         2.73e-07 ***
## IncomeLevel>$150k                                      0.000810 ***
## IncomeLevel$100-150k                                   0.001186 ** 
## IncomeLevel$20-50k                                     0.049638 *  
## IncomeLevel$50-100k                                    1.04e-06 ***
## BMI                                                    0.011947 *  
## CESD.20.1                                              2.67e-05 ***
## SmokingStatusFormer Smoker                             0.504433    
## SmokingStatusNever Smoked                              0.025898 *  
## SmokingStatusOccasional Smoker                         0.286748    
## RelationshipstatusMarried                              0.746819    
## RelationshipstatusSeparated                            0.594524    
## RelationshipstatusSingle                               0.225989    
## RelationshipstatusWidowed                              0.542607    
## LivingstatusAssisted Living                            0.024220 *  
## LivingstatusHouse                                      0.991112    
## LivingstatusOther                                      0.500090    
## AnxietyYes                                             0.846740    
## MoodDisordYes                                          0.278125    
## Chronicconditions                                      0.024786 *  
## PASE_Total                                             2.54e-09 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.943589    
## timefactor3:PandemicFU2 data collected before COVID-19 0.005894 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.3.2.2) Estimated marginal means

lsmeans(modelRVLT_del_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19     9.8 0.237 Inf      9.33      10.3
##  FU2 data collected before COVID-19   10.2 0.240 Inf      9.70      10.6
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.4 0.237 Inf      9.89      10.8
##  FU2 data collected before COVID-19   10.7 0.240 Inf     10.25      11.2
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.9 0.237 Inf     10.48      11.4
##  FU2 data collected before COVID-19   11.1 0.240 Inf     10.58      11.5
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_8trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.373 0.0889 Inf  -4.198  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.367 0.0900 Inf  -4.074  <.0001
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.109 0.0905 Inf  -1.209  0.2265
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_8trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.373 0.0889 Inf    -0.548   -0.1990
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.367 0.0900 Inf    -0.543   -0.1902
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.109 0.0905 Inf    -0.287    0.0679
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.3.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_8trun <- summary(lsmeans(modelRVLT_del_8trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_8trun$Time<-NA
RVLTdelayed_lsmeans_8trun$Time[RVLTdelayed_lsmeans_8trun$timefactor==1]<-"Baseline"
RVLTdelayed_lsmeans_8trun$Time[RVLTdelayed_lsmeans_8trun$timefactor==2]<-"Follow-up 1"
RVLTdelayed_lsmeans_8trun$Time[RVLTdelayed_lsmeans_8trun$timefactor==3]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_8trun, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "RVLT Delayed Score", title = "RVLT Delayed Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

11.3.2.4) Planned contrasts

lsmeans.RVLTDel8trun <- lsmeans(modelRVLT_del_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20402' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20402)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel8trun,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))  0.00675 0.0953 Inf   0.071
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  0.25710 0.0967 Inf   2.658
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  0.26384 0.0958 Inf   2.754
##  p.value
##   0.9436
##   0.0079
##   0.0059
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.3.3) Mental Alteration Test

11.3.3.1) Model

modelMAT_8trun<- lmer(MAT_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                    (1|ID), data= truncated.data_long)
summary(modelMAT_8trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: truncated.data_long
## 
## REML criterion at convergence: 103602.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9324 -0.4800 -0.0217  0.4226  4.7815 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.907    2.215   
##  Residual             8.093    2.845   
## Number of obs: 19603, groups:  ID, 6987
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             9.872e+00  4.618e-01
## timefactor2                                             1.090e+00  6.717e-02
## timefactor3                                            -2.731e-01  6.761e-02
## PandemicFU2 data collected before COVID-19             -3.908e-03  8.799e-02
## Age                                                    -2.577e-03  4.348e-03
## SexM                                                   -1.096e+00  7.553e-02
## EducationHigh School Diploma                            5.325e-03  1.061e-01
## EducationLess than High School Diploma                 -2.912e-02  1.513e-01
## EducationSome College                                   7.804e-02  1.315e-01
## EthnicityWhite                                          1.380e+00  2.110e-01
## IncomeLevel>$150k                                       7.419e-01  1.938e-01
## IncomeLevel$100-150k                                    8.372e-01  1.574e-01
## IncomeLevel$20-50k                                      3.364e-01  1.063e-01
## IncomeLevel$50-100k                                     6.873e-01  1.143e-01
## BMI                                                    -2.270e-02  7.150e-03
## CESD.20.1                                              -4.726e-02  8.533e-03
## SmokingStatusFormer Smoker                              1.741e-01  1.443e-01
## SmokingStatusNever Smoked                               1.158e-01  1.501e-01
## SmokingStatusOccasional Smoker                          1.618e-01  2.852e-01
## RelationshipstatusMarried                               1.802e-01  1.243e-01
## RelationshipstatusSeparated                            -1.733e-01  2.399e-01
## RelationshipstatusSingle                                2.984e-01  1.685e-01
## RelationshipstatusWidowed                              -1.861e-01  1.730e-01
## LivingstatusAssisted Living                            -4.556e-01  5.245e-01
## LivingstatusHouse                                      -1.610e-01  1.135e-01
## LivingstatusOther                                      -2.618e-01  4.236e-01
## AnxietyYes                                              1.170e-01  1.483e-01
## MoodDisordYes                                           3.088e-01  1.069e-01
## Chronicconditions                                      -6.526e-02  1.752e-02
## PASE_Total                                             -7.932e-04  5.020e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -2.752e-01  1.001e-01
## timefactor3:PandemicFU2 data collected before COVID-19  8.568e-02  9.988e-02
##                                                                df t value
## (Intercept)                                             6.993e+03  21.376
## timefactor2                                             1.291e+04  16.221
## timefactor3                                             1.295e+04  -4.040
## PandemicFU2 data collected before COVID-19              1.511e+04  -0.044
## Age                                                     6.928e+03  -0.593
## SexM                                                    6.874e+03 -14.507
## EducationHigh School Diploma                            6.893e+03   0.050
## EducationLess than High School Diploma                  7.072e+03  -0.192
## EducationSome College                                   6.815e+03   0.594
## EthnicityWhite                                          6.951e+03   6.541
## IncomeLevel>$150k                                       6.864e+03   3.829
## IncomeLevel$100-150k                                    6.841e+03   5.321
## IncomeLevel$20-50k                                      6.913e+03   3.163
## IncomeLevel$50-100k                                     6.895e+03   6.015
## BMI                                                     6.832e+03  -3.174
## CESD.20.1                                               6.871e+03  -5.539
## SmokingStatusFormer Smoker                              6.836e+03   1.207
## SmokingStatusNever Smoked                               6.837e+03   0.772
## SmokingStatusOccasional Smoker                          6.790e+03   0.567
## RelationshipstatusMarried                               6.910e+03   1.450
## RelationshipstatusSeparated                             6.875e+03  -0.722
## RelationshipstatusSingle                                6.892e+03   1.771
## RelationshipstatusWidowed                               6.955e+03  -1.076
## LivingstatusAssisted Living                             6.888e+03  -0.869
## LivingstatusHouse                                       6.926e+03  -1.419
## LivingstatusOther                                       6.912e+03  -0.618
## AnxietyYes                                              6.843e+03   0.789
## MoodDisordYes                                           6.836e+03   2.889
## Chronicconditions                                       6.892e+03  -3.724
## PASE_Total                                              6.841e+03  -1.580
## timefactor2:PandemicFU2 data collected before COVID-19  1.290e+04  -2.750
## timefactor3:PandemicFU2 data collected before COVID-19  1.288e+04   0.858
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                            5.37e-05 ***
## PandemicFU2 data collected before COVID-19             0.964574    
## Age                                                    0.553493    
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.959980    
## EducationLess than High School Diploma                 0.847361    
## EducationSome College                                  0.552817    
## EthnicityWhite                                         6.54e-11 ***
## IncomeLevel>$150k                                      0.000130 ***
## IncomeLevel$100-150k                                   1.07e-07 ***
## IncomeLevel$20-50k                                     0.001566 ** 
## IncomeLevel$50-100k                                    1.90e-09 ***
## BMI                                                    0.001508 ** 
## CESD.20.1                                              3.16e-08 ***
## SmokingStatusFormer Smoker                             0.227651    
## SmokingStatusNever Smoked                              0.440239    
## SmokingStatusOccasional Smoker                         0.570396    
## RelationshipstatusMarried                              0.147059    
## RelationshipstatusSeparated                            0.470146    
## RelationshipstatusSingle                               0.076539 .  
## RelationshipstatusWidowed                              0.281992    
## LivingstatusAssisted Living                            0.385105    
## LivingstatusHouse                                      0.156030    
## LivingstatusOther                                      0.536627    
## AnxietyYes                                             0.430189    
## MoodDisordYes                                          0.003881 ** 
## Chronicconditions                                      0.000197 ***
## PASE_Total                                             0.114129    
## timefactor2:PandemicFU2 data collected before COVID-19 0.005972 ** 
## timefactor3:PandemicFU2 data collected before COVID-19 0.391014    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.3.3.2) Estimated marginal means

lsmeans(modelMAT_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.37 0.232 Inf      8.91      9.82
##  FU2 data collected before COVID-19   9.36 0.235 Inf      8.90      9.82
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.46 0.232 Inf     10.00     10.91
##  FU2 data collected before COVID-19  10.18 0.236 Inf      9.72     10.64
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.09 0.232 Inf      8.64      9.55
##  FU2 data collected before COVID-19   9.18 0.236 Inf      8.71      9.64
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_8trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.00391 0.0880 Inf   0.044  0.9646
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.27908 0.0917 Inf   3.045  0.0023
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##  -0.08177 0.0914 Inf  -0.894  0.3712
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_8trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.00391 0.0880 Inf   -0.1685    0.1764
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.27908 0.0917 Inf    0.0994    0.4587
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##  -0.08177 0.0914 Inf   -0.2610    0.0975
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.3.3.3) Graph of estimated marginal means

MAT_lsmeans_8trun <- summary(lsmeans(modelMAT_8trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_8trun$Time<-NA
MAT_lsmeans_8trun$Time[MAT_lsmeans_8trun$timefactor==1]<-"Baseline"
MAT_lsmeans_8trun$Time[MAT_lsmeans_8trun$timefactor==2]<-"Follow-up 1"
MAT_lsmeans_8trun$Time[MAT_lsmeans_8trun$timefactor==3]<-"Follow-up 2"
ggplot(MAT_lsmeans_8trun, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "MAT Score", title = "Mental Alteration Test Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

11.3.3.4) Planned contrasts

lsmeans.MAT8trun <- lsmeans(modelMAT_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19603' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19603)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT8trun,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.2752 0.1001 Inf   2.750
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))  -0.3609 0.1030 Inf  -3.504
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))  -0.0857 0.0999 Inf  -0.858
##  p.value
##   0.0060
##   0.0005
##   0.3910
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.3.4) Animal Fluency

11.3.4.1) Model

modelAnimals_8trun<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                        (1|ID), data= truncated.data_long)
summary(modelAnimals_8trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: truncated.data_long
## 
## REML criterion at convergence: 96464.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3556 -0.5650 -0.0117  0.5536  4.4684 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.871    2.207   
##  Residual             3.648    1.910   
## Number of obs: 20626, groups:  ID, 6987
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             8.979e+00  4.065e-01
## timefactor2                                            -1.427e-01  4.386e-02
## timefactor3                                            -5.172e-02  4.435e-02
## PandemicFU2 data collected before COVID-19              2.025e-01  7.142e-02
## Age                                                    -2.083e-03  3.828e-03
## SexM                                                   -2.582e-01  6.667e-02
## EducationHigh School Diploma                            3.276e-01  9.359e-02
## EducationLess than High School Diploma                  3.278e-01  1.324e-01
## EducationSome College                                   2.877e-01  1.163e-01
## EthnicityWhite                                          1.379e+00  1.855e-01
## IncomeLevel>$150k                                       5.279e-01  1.711e-01
## IncomeLevel$100-150k                                    4.182e-01  1.391e-01
## IncomeLevel$20-50k                                      5.155e-02  9.370e-02
## IncomeLevel$50-100k                                     2.568e-01  1.008e-01
## BMI                                                    -1.644e-02  6.320e-03
## CESD.20.1                                              -3.514e-02  7.533e-03
## SmokingStatusFormer Smoker                              2.922e-01  1.276e-01
## SmokingStatusNever Smoked                               2.416e-01  1.327e-01
## SmokingStatusOccasional Smoker                          4.370e-01  2.522e-01
## RelationshipstatusMarried                              -2.504e-01  1.096e-01
## RelationshipstatusSeparated                            -7.852e-02  2.120e-01
## RelationshipstatusSingle                               -1.519e-01  1.486e-01
## RelationshipstatusWidowed                              -2.843e-01  1.521e-01
## LivingstatusAssisted Living                            -2.298e-01  4.625e-01
## LivingstatusHouse                                       3.577e-01  9.996e-02
## LivingstatusOther                                       2.292e-01  3.724e-01
## AnxietyYes                                             -4.920e-02  1.311e-01
## MoodDisordYes                                           2.641e-01  9.452e-02
## Chronicconditions                                      -7.964e-03  1.545e-02
## PASE_Total                                              1.159e-03  4.436e-04
## timefactor2:PandemicFU2 data collected before COVID-19  8.875e-03  6.527e-02
## timefactor3:PandemicFU2 data collected before COVID-19  4.496e-02  6.564e-02
##                                                                df t value
## (Intercept)                                             7.007e+03  22.087
## timefactor2                                             1.367e+04  -3.255
## timefactor3                                             1.372e+04  -1.166
## PandemicFU2 data collected before COVID-19              1.227e+04   2.836
## Age                                                     6.949e+03  -0.544
## SexM                                                    6.954e+03  -3.872
## EducationHigh School Diploma                            6.962e+03   3.501
## EducationLess than High School Diploma                  6.982e+03   2.475
## EducationSome College                                   6.938e+03   2.473
## EthnicityWhite                                          6.943e+03   7.431
## IncomeLevel>$150k                                       6.955e+03   3.085
## IncomeLevel$100-150k                                    6.948e+03   3.007
## IncomeLevel$20-50k                                      6.954e+03   0.550
## IncomeLevel$50-100k                                     6.955e+03   2.548
## BMI                                                     6.945e+03  -2.601
## CESD.20.1                                               6.959e+03  -4.665
## SmokingStatusFormer Smoker                              6.954e+03   2.291
## SmokingStatusNever Smoked                               6.954e+03   1.821
## SmokingStatusOccasional Smoker                          6.924e+03   1.733
## RelationshipstatusMarried                               6.969e+03  -2.284
## RelationshipstatusSeparated                             6.974e+03  -0.370
## RelationshipstatusSingle                                6.965e+03  -1.022
## RelationshipstatusWidowed                               6.955e+03  -1.869
## LivingstatusAssisted Living                             6.974e+03  -0.497
## LivingstatusHouse                                       6.964e+03   3.578
## LivingstatusOther                                       6.901e+03   0.615
## AnxietyYes                                              6.951e+03  -0.375
## MoodDisordYes                                           6.957e+03   2.794
## Chronicconditions                                       6.945e+03  -0.516
## PASE_Total                                              6.949e+03   2.612
## timefactor2:PandemicFU2 data collected before COVID-19  1.366e+04   0.136
## timefactor3:PandemicFU2 data collected before COVID-19  1.369e+04   0.685
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.001138 ** 
## timefactor3                                            0.243588    
## PandemicFU2 data collected before COVID-19             0.004580 ** 
## Age                                                    0.586412    
## SexM                                                   0.000109 ***
## EducationHigh School Diploma                           0.000467 ***
## EducationLess than High School Diploma                 0.013341 *  
## EducationSome College                                  0.013404 *  
## EthnicityWhite                                         1.20e-13 ***
## IncomeLevel>$150k                                      0.002041 ** 
## IncomeLevel$100-150k                                   0.002651 ** 
## IncomeLevel$20-50k                                     0.582215    
## IncomeLevel$50-100k                                    0.010848 *  
## BMI                                                    0.009302 ** 
## CESD.20.1                                              3.15e-06 ***
## SmokingStatusFormer Smoker                             0.021996 *  
## SmokingStatusNever Smoked                              0.068609 .  
## SmokingStatusOccasional Smoker                         0.083147 .  
## RelationshipstatusMarried                              0.022373 *  
## RelationshipstatusSeparated                            0.711183    
## RelationshipstatusSingle                               0.306991    
## RelationshipstatusWidowed                              0.061663 .  
## LivingstatusAssisted Living                            0.619357    
## LivingstatusHouse                                      0.000349 ***
## LivingstatusOther                                      0.538362    
## AnxietyYes                                             0.707469    
## MoodDisordYes                                          0.005215 ** 
## Chronicconditions                                      0.606167    
## PASE_Total                                             0.009023 ** 
## timefactor2:PandemicFU2 data collected before COVID-19 0.891832    
## timefactor3:PandemicFU2 data collected before COVID-19 0.493368    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.3.4.2) Estimated marginal means

lsmeans(modelAnimals_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.75 0.203 Inf      9.35      10.1
##  FU2 data collected before COVID-19   9.95 0.206 Inf      9.55      10.4
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.61 0.203 Inf      9.21      10.0
##  FU2 data collected before COVID-19   9.82 0.206 Inf      9.42      10.2
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.70 0.203 Inf      9.30      10.1
##  FU2 data collected before COVID-19   9.95 0.206 Inf      9.54      10.3
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_8trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.203 0.0714 Inf  -2.836  0.0046
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.211 0.0717 Inf  -2.948  0.0032
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.247 0.0721 Inf  -3.434  0.0006
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_8trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.203 0.0714 Inf    -0.343   -0.0625
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.211 0.0717 Inf    -0.352   -0.0709
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.247 0.0721 Inf    -0.389   -0.1062
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.3.4.3) Graph of estimated marginal means

Animals_lsmeans_8trun <- summary(lsmeans(modelAnimals_8trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_8trun$Time<-NA
Animals_lsmeans_8trun$Time[Animals_lsmeans_8trun$timefactor==1]<-"Baseline"
Animals_lsmeans_8trun$Time[Animals_lsmeans_8trun$timefactor==2]<-"Follow-up 1"
Animals_lsmeans_8trun$Time[Animals_lsmeans_8trun$timefactor==3]<-"Follow-up 2"
ggplot(Animals_lsmeans_8trun, aes(x = Time, y = lsmean, group=Pandemic)) +
  geom_line(aes(linetype = Pandemic)) + 
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Animal Fluency (words)", title = "Animal Fluency Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

11.3.4.4) Planned contrasts

lsmeans.Animals8trun <- lsmeans(modelAnimals_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 20626' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 20626)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals8trun,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L)) -0.00888 0.0653 Inf  -0.136
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L)) -0.03609 0.0659 Inf  -0.547
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L)) -0.04496 0.0656 Inf  -0.685
##  p.value
##   0.8918
##   0.5842
##   0.4934
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.3.5) Global cognition composite score

11.3.5.1) Models

modelGlobal_8trun<- lmer(Global_Composite ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus + 
                         Relationshipstatus + Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total +
                       (1|ID), data= truncated.data_long)
summary(modelGlobal_8trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.20.1 + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + (1 | ID)
##    Data: truncated.data_long
## 
## REML criterion at convergence: 93393
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7450 -0.5450 -0.0365  0.5046  3.8739 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 5.240    2.289   
##  Residual             4.251    2.062   
## Number of obs: 19370, groups:  ID, 6987
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                            -2.107e+00  4.299e-01
## timefactor2                                             7.799e-01  4.916e-02
## timefactor3                                             6.981e-01  4.941e-02
## PandemicFU2 data collected before COVID-19              3.338e-01  7.539e-02
## Age                                                     1.735e-02  4.052e-03
## SexM                                                   -8.938e-01  7.042e-02
## EducationHigh School Diploma                            3.034e-01  9.888e-02
## EducationLess than High School Diploma                  5.140e-01  1.408e-01
## EducationSome College                                   2.749e-01  1.227e-01
## EthnicityWhite                                          1.736e+00  1.965e-01
## IncomeLevel>$150k                                       1.015e+00  1.807e-01
## IncomeLevel$100-150k                                    8.004e-01  1.468e-01
## IncomeLevel$20-50k                                      2.729e-01  9.906e-02
## IncomeLevel$50-100k                                     7.227e-01  1.065e-01
## BMI                                                    -2.584e-02  6.669e-03
## CESD.20.1                                              -5.209e-02  7.956e-03
## SmokingStatusFormer Smoker                              2.918e-01  1.346e-01
## SmokingStatusNever Smoked                               3.794e-01  1.400e-01
## SmokingStatusOccasional Smoker                          4.911e-01  2.661e-01
## RelationshipstatusMarried                              -6.066e-02  1.158e-01
## RelationshipstatusSeparated                            -2.550e-01  2.238e-01
## RelationshipstatusSingle                               -7.976e-02  1.570e-01
## RelationshipstatusWidowed                              -2.620e-01  1.612e-01
## LivingstatusAssisted Living                            -6.976e-01  4.896e-01
## LivingstatusHouse                                       7.397e-02  1.057e-01
## LivingstatusOther                                      -1.868e-01  3.952e-01
## AnxietyYes                                             -2.236e-03  1.383e-01
## MoodDisordYes                                           1.396e-01  9.968e-02
## Chronicconditions                                      -4.652e-02  1.633e-02
## PASE_Total                                              1.994e-03  4.682e-04
## timefactor2:PandemicFU2 data collected before COVID-19 -1.577e-01  7.325e-02
## timefactor3:PandemicFU2 data collected before COVID-19 -1.739e-01  7.301e-02
##                                                                df t value
## (Intercept)                                             6.980e+03  -4.901
## timefactor2                                             1.262e+04  15.865
## timefactor3                                             1.264e+04  14.127
## PandemicFU2 data collected before COVID-19              1.215e+04   4.428
## Age                                                     6.951e+03   4.282
## SexM                                                    6.903e+03 -12.692
## EducationHigh School Diploma                            6.913e+03   3.069
## EducationLess than High School Diploma                  7.083e+03   3.651
## EducationSome College                                   6.865e+03   2.240
## EthnicityWhite                                          6.959e+03   8.835
## IncomeLevel>$150k                                       6.891e+03   5.619
## IncomeLevel$100-150k                                    6.876e+03   5.454
## IncomeLevel$20-50k                                      6.926e+03   2.755
## IncomeLevel$50-100k                                     6.910e+03   6.789
## BMI                                                     6.869e+03  -3.874
## CESD.20.1                                               6.904e+03  -6.547
## SmokingStatusFormer Smoker                              6.885e+03   2.168
## SmokingStatusNever Smoked                               6.885e+03   2.709
## SmokingStatusOccasional Smoker                          6.848e+03   1.845
## RelationshipstatusMarried                               6.932e+03  -0.524
## RelationshipstatusSeparated                             6.907e+03  -1.140
## RelationshipstatusSingle                                6.908e+03  -0.508
## RelationshipstatusWidowed                               6.976e+03  -1.626
## LivingstatusAssisted Living                             6.937e+03  -1.425
## LivingstatusHouse                                       6.938e+03   0.700
## LivingstatusOther                                       6.949e+03  -0.473
## AnxietyYes                                              6.871e+03  -0.016
## MoodDisordYes                                           6.868e+03   1.400
## Chronicconditions                                       6.918e+03  -2.848
## PASE_Total                                              6.878e+03   4.260
## timefactor2:PandemicFU2 data collected before COVID-19  1.261e+04  -2.153
## timefactor3:PandemicFU2 data collected before COVID-19  1.260e+04  -2.382
##                                                        Pr(>|t|)    
## (Intercept)                                            9.76e-07 ***
## timefactor2                                             < 2e-16 ***
## timefactor3                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             9.61e-06 ***
## Age                                                    1.88e-05 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.002156 ** 
## EducationLess than High School Diploma                 0.000263 ***
## EducationSome College                                  0.025153 *  
## EthnicityWhite                                          < 2e-16 ***
## IncomeLevel>$150k                                      1.99e-08 ***
## IncomeLevel$100-150k                                   5.10e-08 ***
## IncomeLevel$20-50k                                     0.005883 ** 
## IncomeLevel$50-100k                                    1.22e-11 ***
## BMI                                                    0.000108 ***
## CESD.20.1                                              6.30e-11 ***
## SmokingStatusFormer Smoker                             0.030214 *  
## SmokingStatusNever Smoked                              0.006761 ** 
## SmokingStatusOccasional Smoker                         0.065045 .  
## RelationshipstatusMarried                              0.600532    
## RelationshipstatusSeparated                            0.254451    
## RelationshipstatusSingle                               0.611428    
## RelationshipstatusWidowed                              0.104096    
## LivingstatusAssisted Living                            0.154214    
## LivingstatusHouse                                      0.484060    
## LivingstatusOther                                      0.636489    
## AnxietyYes                                             0.987099    
## MoodDisordYes                                          0.161495    
## Chronicconditions                                      0.004410 ** 
## PASE_Total                                             2.07e-05 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.031320 *  
## timefactor3:PandemicFU2 data collected before COVID-19 0.017213 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 32 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.3.5.2) Estimated marginal means

lsmeans(modelGlobal_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19  -0.501 0.215 Inf   -0.9219   -0.0795
##  FU2 data collected before COVID-19 -0.167 0.218 Inf   -0.5939    0.2600
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.279 0.215 Inf   -0.1431    0.7015
##  FU2 data collected before COVID-19  0.455 0.218 Inf    0.0271    0.8834
## 
## timefactor = 3:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.197 0.215 Inf   -0.2248    0.6195
##  FU2 data collected before COVID-19  0.357 0.218 Inf   -0.0707    0.7850
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_8trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.334 0.0754 Inf  -4.428  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.176 0.0783 Inf  -2.248  0.0246
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.160 0.0781 Inf  -2.047  0.0407
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_8trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.334 0.0754 Inf    -0.482  -0.18604
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.176 0.0783 Inf    -0.330  -0.02254
## 
## timefactor = 3:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.160 0.0781 Inf    -0.313  -0.00679
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.3.5.3) Graph of estimated marginal means

Global_lsmeans_8trun <- summary(lsmeans(modelGlobal_8trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_8trun$Time<-NA
Global_lsmeans_8trun$Time[Global_lsmeans_8trun$timefactor==1]<-"Baseline"
Global_lsmeans_8trun$Time[Global_lsmeans_8trun$timefactor==2]<-"Follow-up 1"
Global_lsmeans_8trun$Time[Global_lsmeans_8trun$timefactor==3]<-"Follow-up 2"
ggplot(Global_lsmeans_8trun, aes(x = Time, y = lsmean, group = Pandemic)) +
  geom_line(aes(linetype = Pandemic)) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), width = 0.2) +
  geom_point(aes(y = lsmean), size = 3, shape = 21, fill = "white") +
  labs(x = "Time", y = "Global Cognitive Composite Score", title = "Global Cognitive Composite Score from Baseline to FU2 by Pandemic status") +
  theme_bw()

11.3.5.4) Planned contrasts

lsmeans.Global8trun <- lsmeans(modelGlobal_8trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 19370' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 19370)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global8trun,list(c1st,c2nd,c3rd),by=NULL)
##  contrast                                           estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1, 0, 0), .Dim = c(6L, 1L))   0.1577 0.0733 Inf   2.153
##  structure(c(0, 0, -1, 1, 1, -1), .Dim = c(6L, 1L))   0.0162 0.0758 Inf   0.214
##  structure(c(-1, 1, 0, 0, 1, -1), .Dim = c(6L, 1L))   0.1739 0.0730 Inf   2.382
##  p.value
##   0.0313
##   0.8308
##   0.0172
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.4) Full Adjusted Model: Time x Pandemic effects on cognition and physical activity ( adjusting for baseline)

All models use normalized cognitive scores. Each model is adjusted for baseline age, sex, education, ethnicity, income level, baseline BMI, baseline CESD-10 score, smoking status, relationship status at baseline, living status at baseline, diagnosis of anxiety or mood disorder at baseline, number of chronic conditions at baseline, baseline PASE score, and baseline cognitive performance

11.4.1) RVLT Immediate Recall

11.4.1.1) Model

modelRVLT_imm_adj10trun<- lmer(RVLT_Immediate_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + RVLT_Immediate_Normedbaseline +
                            (1|ID), data= truncated.data_long_2)
summary(modelRVLT_imm_adj10trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## RVLT_Immediate_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + RVLT_Immediate_Normedbaseline +  
##     (1 | ID)
##    Data: truncated.data_long_2
## 
## REML criterion at convergence: 70686.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6998 -0.5714 -0.0379  0.5273  3.8358 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 3.951    1.988   
##  Residual             7.521    2.743   
## Number of obs: 13535, groups:  ID, 6973
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.310e+00  4.650e-01
## timefactor2                                             3.109e-01  6.425e-02
## PandemicFU2 data collected before COVID-19              1.741e-01  8.368e-02
## Age                                                    -1.625e-02  4.367e-03
## SexM                                                   -5.030e-01  7.602e-02
## EducationHigh School Diploma                            2.889e-01  1.063e-01
## EducationLess than High School Diploma                  4.337e-01  1.512e-01
## EducationSome College                                   1.433e-01  1.319e-01
## EthnicityWhite                                          6.392e-01  2.106e-01
## IncomeLevel>$150k                                       3.879e-01  1.947e-01
## IncomeLevel$100-150k                                    2.799e-01  1.578e-01
## IncomeLevel$20-50k                                      1.605e-01  1.064e-01
## IncomeLevel$50-100k                                     4.062e-01  1.145e-01
## BMI                                                    -1.609e-02  7.173e-03
## CESD.10baseline                                        -2.310e-02  8.556e-03
## SmokingStatusFormer Smoker                              2.334e-01  1.450e-01
## SmokingStatusNever Smoked                               3.461e-01  1.508e-01
## SmokingStatusOccasional Smoker                          4.729e-02  2.850e-01
## RelationshipstatusMarried                               3.348e-01  1.245e-01
## RelationshipstatusSeparated                             3.097e-01  2.415e-01
## RelationshipstatusSingle                                2.316e-01  1.689e-01
## RelationshipstatusWidowed                               3.257e-02  1.729e-01
## LivingstatusAssisted Living                            -9.343e-01  5.249e-01
## LivingstatusHouse                                      -3.798e-02  1.136e-01
## LivingstatusOther                                      -5.045e-01  4.209e-01
## AnxietyYes                                              5.017e-02  1.486e-01
## MoodDisordYes                                          -1.114e-01  1.073e-01
## Chronicconditions                                      -2.421e-02  1.754e-02
## PASE_Total                                              2.198e-03  5.041e-04
## RVLT_Immediate_Normedbaseline                           3.554e-01  8.988e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -7.979e-02  9.517e-02
##                                                                df t value
## (Intercept)                                             6.954e+03  15.720
## timefactor2                                             6.830e+03   4.839
## PandemicFU2 data collected before COVID-19              1.203e+04   2.081
## Age                                                     6.915e+03  -3.721
## SexM                                                    6.911e+03  -6.617
## EducationHigh School Diploma                            6.917e+03   2.718
## EducationLess than High School Diploma                  7.040e+03   2.869
## EducationSome College                                   6.839e+03   1.086
## EthnicityWhite                                          6.840e+03   3.035
## IncomeLevel>$150k                                       6.916e+03   1.992
## IncomeLevel$100-150k                                    6.873e+03   1.774
## IncomeLevel$20-50k                                      6.924e+03   1.508
## IncomeLevel$50-100k                                     6.921e+03   3.547
## BMI                                                     6.887e+03  -2.244
## CESD.10baseline                                         6.911e+03  -2.699
## SmokingStatusFormer Smoker                              6.937e+03   1.610
## SmokingStatusNever Smoked                               6.937e+03   2.295
## SmokingStatusOccasional Smoker                          6.807e+03   0.166
## RelationshipstatusMarried                               6.926e+03   2.690
## RelationshipstatusSeparated                             6.989e+03   1.282
## RelationshipstatusSingle                                6.926e+03   1.371
## RelationshipstatusWidowed                               6.931e+03   0.188
## LivingstatusAssisted Living                             6.929e+03  -1.780
## LivingstatusHouse                                       6.923e+03  -0.334
## LivingstatusOther                                       6.794e+03  -1.199
## AnxietyYes                                              6.894e+03   0.338
## MoodDisordYes                                           6.909e+03  -1.038
## Chronicconditions                                       6.902e+03  -1.381
## PASE_Total                                              6.898e+03   4.360
## RVLT_Immediate_Normedbaseline                           6.927e+03  39.546
## timefactor2:PandemicFU2 data collected before COVID-19  6.778e+03  -0.838
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            1.33e-06 ***
## PandemicFU2 data collected before COVID-19             0.037474 *  
## Age                                                    0.000200 ***
## SexM                                                   3.93e-11 ***
## EducationHigh School Diploma                           0.006591 ** 
## EducationLess than High School Diploma                 0.004131 ** 
## EducationSome College                                  0.277388    
## EthnicityWhite                                         0.002417 ** 
## IncomeLevel>$150k                                      0.046385 *  
## IncomeLevel$100-150k                                   0.076170 .  
## IncomeLevel$20-50k                                     0.131549    
## IncomeLevel$50-100k                                    0.000392 ***
## BMI                                                    0.024890 *  
## CESD.10baseline                                        0.006964 ** 
## SmokingStatusFormer Smoker                             0.107355    
## SmokingStatusNever Smoked                              0.021759 *  
## SmokingStatusOccasional Smoker                         0.868203    
## RelationshipstatusMarried                              0.007166 ** 
## RelationshipstatusSeparated                            0.199713    
## RelationshipstatusSingle                               0.170337    
## RelationshipstatusWidowed                              0.850629    
## LivingstatusAssisted Living                            0.075114 .  
## LivingstatusHouse                                      0.738135    
## LivingstatusOther                                      0.230711    
## AnxietyYes                                             0.735738    
## MoodDisordYes                                          0.299306    
## Chronicconditions                                      0.167449    
## PASE_Total                                             1.32e-05 ***
## RVLT_Immediate_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.401822    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.4.1.2) Estimated marginal means

lsmeans(modelRVLT_imm_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.3 0.231 Inf      9.81      10.7
##  FU2 data collected before COVID-19   10.4 0.234 Inf      9.98      10.9
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.6 0.231 Inf     10.12      11.0
##  FU2 data collected before COVID-19   10.7 0.234 Inf     10.21      11.1
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_imm_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.1741 0.0837 Inf  -2.081  0.0375
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   -0.0943 0.0843 Inf  -1.119  0.2631
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_imm_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.1741 0.0837 Inf    -0.338   -0.0101
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   -0.0943 0.0843 Inf    -0.260    0.0709
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.4.1.3) Graph of estimated marginal means

RVLTimmediate_lsmeans_adj10trun <- summary(lsmeans(modelRVLT_imm_adj10trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTimmediate_lsmeans_adj10trun$Time<-NA
RVLTimmediate_lsmeans_adj10trun$Time[RVLTimmediate_lsmeans_adj10trun$timefactor==1]<-"Follow-up 1"
RVLTimmediate_lsmeans_adj10trun$Time[RVLTimmediate_lsmeans_adj10trun$timefactor==2]<-"Follow-up 2"
ggplot(RVLTimmediate_lsmeans_adj10trun, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Immediate Normalized Score", title = "RVLT Immediate Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

11.4.1.4) Planned contrasts

lsmeans.RVLTImm10trun <- lsmeans(modelRVLT_imm_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13535' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13535)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTImm10trun,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   0.0798 0.0952 Inf   0.838
##  p.value
##   0.4018
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.4.2) RVLT Delayed Recall

11.4.2.1) Model

modelRVLT_del_adj10trun<- lmer(RVLT_Delayed_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + RVLT_Delayed_Normedbaseline +
                            (1|ID), data= truncated.data_long_2)
summary(modelRVLT_del_adj10trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RVLT_Delayed_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + RVLT_Delayed_Normedbaseline +  
##     (1 | ID)
##    Data: truncated.data_long_2
## 
## REML criterion at convergence: 69370.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9097 -0.5557 -0.0353  0.5142  4.0193 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 4.094    2.023   
##  Residual             6.916    2.630   
## Number of obs: 13415, groups:  ID, 6961
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             6.692e+00  4.627e-01
## timefactor2                                             5.846e-01  6.205e-02
## PandemicFU2 data collected before COVID-19              2.559e-01  8.231e-02
## Age                                                    -8.322e-03  4.343e-03
## SexM                                                   -4.549e-01  7.530e-02
## EducationHigh School Diploma                            2.210e-01  1.056e-01
## EducationLess than High School Diploma                  2.909e-01  1.506e-01
## EducationSome College                                   3.171e-01  1.307e-01
## EthnicityWhite                                          6.681e-01  2.104e-01
## IncomeLevel>$150k                                       2.581e-01  1.929e-01
## IncomeLevel$100-150k                                    1.625e-01  1.566e-01
## IncomeLevel$20-50k                                      1.723e-01  1.057e-01
## IncomeLevel$50-100k                                     4.387e-01  1.136e-01
## BMI                                                    -1.830e-02  7.112e-03
## CESD.10baseline                                        -2.062e-02  8.500e-03
## SmokingStatusFormer Smoker                              1.293e-01  1.436e-01
## SmokingStatusNever Smoked                               3.377e-01  1.494e-01
## SmokingStatusOccasional Smoker                          2.223e-01  2.831e-01
## RelationshipstatusMarried                               3.936e-02  1.237e-01
## RelationshipstatusSeparated                            -1.141e-01  2.398e-01
## RelationshipstatusSingle                               -5.020e-02  1.676e-01
## RelationshipstatusWidowed                              -1.397e-01  1.718e-01
## LivingstatusAssisted Living                            -1.257e+00  5.220e-01
## LivingstatusHouse                                       4.488e-02  1.128e-01
## LivingstatusOther                                      -1.792e-01  4.192e-01
## AnxietyYes                                              5.259e-02  1.476e-01
## MoodDisordYes                                          -1.189e-01  1.064e-01
## Chronicconditions                                      -2.792e-02  1.740e-02
## PASE_Total                                              2.433e-03  5.004e-04
## RVLT_Delayed_Normedbaseline                             3.953e-01  9.114e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -2.551e-01  9.182e-02
##                                                                df t value
## (Intercept)                                             6.969e+03  14.462
## timefactor2                                             6.770e+03   9.421
## PandemicFU2 data collected before COVID-19              1.178e+04   3.109
## Age                                                     6.907e+03  -1.916
## SexM                                                    6.890e+03  -6.042
## EducationHigh School Diploma                            6.904e+03   2.093
## EducationLess than High School Diploma                  7.068e+03   1.932
## EducationSome College                                   6.802e+03   2.427
## EthnicityWhite                                          6.926e+03   3.175
## IncomeLevel>$150k                                       6.891e+03   1.338
## IncomeLevel$100-150k                                    6.858e+03   1.038
## IncomeLevel$20-50k                                      6.917e+03   1.630
## IncomeLevel$50-100k                                     6.901e+03   3.860
## BMI                                                     6.849e+03  -2.573
## CESD.10baseline                                         6.915e+03  -2.426
## SmokingStatusFormer Smoker                              6.902e+03   0.901
## SmokingStatusNever Smoked                               6.902e+03   2.260
## SmokingStatusOccasional Smoker                          6.830e+03   0.785
## RelationshipstatusMarried                               6.890e+03   0.318
## RelationshipstatusSeparated                             6.999e+03  -0.476
## RelationshipstatusSingle                                6.882e+03  -0.300
## RelationshipstatusWidowed                               6.912e+03  -0.813
## LivingstatusAssisted Living                             6.970e+03  -2.407
## LivingstatusHouse                                       6.921e+03   0.398
## LivingstatusOther                                       6.858e+03  -0.428
## AnxietyYes                                              6.870e+03   0.356
## MoodDisordYes                                           6.877e+03  -1.118
## Chronicconditions                                       6.874e+03  -1.604
## PASE_Total                                              6.889e+03   4.863
## RVLT_Delayed_Normedbaseline                             6.894e+03  43.370
## timefactor2:PandemicFU2 data collected before COVID-19  6.710e+03  -2.778
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             0.001883 ** 
## Age                                                    0.055388 .  
## SexM                                                   1.60e-09 ***
## EducationHigh School Diploma                           0.036387 *  
## EducationLess than High School Diploma                 0.053383 .  
## EducationSome College                                  0.015265 *  
## EthnicityWhite                                         0.001505 ** 
## IncomeLevel>$150k                                      0.181073    
## IncomeLevel$100-150k                                   0.299447    
## IncomeLevel$20-50k                                     0.103095    
## IncomeLevel$50-100k                                    0.000114 ***
## BMI                                                    0.010114 *  
## CESD.10baseline                                        0.015285 *  
## SmokingStatusFormer Smoker                             0.367755    
## SmokingStatusNever Smoked                              0.023831 *  
## SmokingStatusOccasional Smoker                         0.432412    
## RelationshipstatusMarried                              0.750375    
## RelationshipstatusSeparated                            0.634240    
## RelationshipstatusSingle                               0.764487    
## RelationshipstatusWidowed                              0.416002    
## LivingstatusAssisted Living                            0.016090 *  
## LivingstatusHouse                                      0.690858    
## LivingstatusOther                                      0.668932    
## AnxietyYes                                             0.721555    
## MoodDisordYes                                          0.263712    
## Chronicconditions                                      0.108660    
## PASE_Total                                             1.18e-06 ***
## RVLT_Delayed_Normedbaseline                             < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.005487 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.4.2.2) Estimated marginal means

lsmeans(modelRVLT_del_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    10.4 0.229 Inf      9.97      10.9
##  FU2 data collected before COVID-19   10.7 0.232 Inf     10.22      11.1
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    11.0 0.229 Inf     10.56      11.5
##  FU2 data collected before COVID-19   11.0 0.232 Inf     10.55      11.5
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelRVLT_del_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##   estimate     SE  df z.ratio p.value
##  -0.255875 0.0823 Inf  -3.109  0.0019
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##   estimate     SE  df z.ratio p.value
##  -0.000812 0.0829 Inf  -0.010  0.9922
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelRVLT_del_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##   estimate     SE  df asymp.LCL asymp.UCL
##  -0.255875 0.0823 Inf    -0.417   -0.0946
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##   estimate     SE  df asymp.LCL asymp.UCL
##  -0.000812 0.0829 Inf    -0.163    0.1616
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.4.2.3) Graph of estimated marginal means

RVLTdelayed_lsmeans_adj10trun <- summary(lsmeans(modelRVLT_del_adj10trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
RVLTdelayed_lsmeans_adj10trun$Time<-NA
RVLTdelayed_lsmeans_adj10trun$Time[RVLTdelayed_lsmeans_adj10trun$timefactor==1]<-"Follow-up 1"
RVLTdelayed_lsmeans_adj10trun$Time[RVLTdelayed_lsmeans_adj10trun$timefactor==2]<-"Follow-up 2"
ggplot(RVLTdelayed_lsmeans_adj10trun, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "RVLT Delayed Normalized Score", title = "RVLT Delayed Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

11.4.2.4) Planned contrasts

lsmeans.RVLTDel10trun <- lsmeans(modelRVLT_del_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13415' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13415)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.RVLTDel10trun,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))    0.255 0.0918 Inf   2.778
##  p.value
##   0.0055
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.4.3) Mental Alteration Test

11.4.3.1) Model

modelMAT_adj10trun<- lmer(MAT_Normed~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + MAT_Normedbaseline +
                      (1|ID), data= truncated.data_long_2)
summary(modelMAT_adj10trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MAT_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + MAT_Normedbaseline + (1 |      ID)
##    Data: truncated.data_long_2
## 
## REML criterion at convergence: 66278.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3069 -0.5275 -0.0879  0.3683  4.7473 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.248    1.499   
##  Residual             9.083    3.014   
## Number of obs: 12616, groups:  ID, 6874
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             7.818e+00  4.569e-01
## timefactor2                                            -1.367e+00  7.348e-02
## PandemicFU2 data collected before COVID-19             -3.648e-01  8.637e-02
## Age                                                    -1.199e-02  4.239e-03
## SexM                                                   -1.227e+00  7.340e-02
## EducationHigh School Diploma                           -3.722e-02  1.031e-01
## EducationLess than High School Diploma                 -1.354e-01  1.492e-01
## EducationSome College                                  -2.331e-02  1.270e-01
## EthnicityWhite                                          9.034e-01  2.063e-01
## IncomeLevel>$150k                                       1.273e-01  1.881e-01
## IncomeLevel$100-150k                                    1.462e-01  1.526e-01
## IncomeLevel$20-50k                                      1.663e-01  1.036e-01
## IncomeLevel$50-100k                                     1.509e-01  1.114e-01
## BMI                                                    -1.323e-02  6.920e-03
## CESD.10baseline                                        -2.175e-02  8.296e-03
## SmokingStatusFormer Smoker                              8.338e-03  1.396e-01
## SmokingStatusNever Smoked                              -8.297e-02  1.452e-01
## SmokingStatusOccasional Smoker                          1.660e-01  2.751e-01
## RelationshipstatusMarried                              -4.425e-03  1.210e-01
## RelationshipstatusSeparated                            -6.076e-02  2.328e-01
## RelationshipstatusSingle                                5.469e-01  1.637e-01
## RelationshipstatusWidowed                              -1.947e-01  1.689e-01
## LivingstatusAssisted Living                            -1.228e-01  5.100e-01
## LivingstatusHouse                                      -1.599e-01  1.106e-01
## LivingstatusOther                                      -1.830e-01  4.123e-01
## AnxietyYes                                              8.310e-02  1.435e-01
## MoodDisordYes                                           1.138e-01  1.035e-01
## Chronicconditions                                      -3.578e-02  1.704e-02
## PASE_Total                                             -5.028e-04  4.859e-04
## MAT_Normedbaseline                                      4.422e-01  9.591e-03
## timefactor2:PandemicFU2 data collected before COVID-19  3.692e-01  1.087e-01
##                                                                df t value
## (Intercept)                                             6.718e+03  17.112
## timefactor2                                             6.458e+03 -18.600
## PandemicFU2 data collected before COVID-19              1.219e+04  -4.224
## Age                                                     6.692e+03  -2.828
## SexM                                                    6.612e+03 -16.714
## EducationHigh School Diploma                            6.615e+03  -0.361
## EducationLess than High School Diploma                  6.833e+03  -0.908
## EducationSome College                                   6.532e+03  -0.184
## EthnicityWhite                                          6.702e+03   4.378
## IncomeLevel>$150k                                       6.589e+03   0.677
## IncomeLevel$100-150k                                    6.576e+03   0.958
## IncomeLevel$20-50k                                      6.669e+03   1.606
## IncomeLevel$50-100k                                     6.629e+03   1.355
## BMI                                                     6.537e+03  -1.912
## CESD.10baseline                                         6.592e+03  -2.621
## SmokingStatusFormer Smoker                              6.546e+03   0.060
## SmokingStatusNever Smoked                               6.549e+03  -0.571
## SmokingStatusOccasional Smoker                          6.411e+03   0.603
## RelationshipstatusMarried                               6.673e+03  -0.037
## RelationshipstatusSeparated                             6.669e+03  -0.261
## RelationshipstatusSingle                                6.649e+03   3.341
## RelationshipstatusWidowed                               6.733e+03  -1.152
## LivingstatusAssisted Living                             6.525e+03  -0.241
## LivingstatusHouse                                       6.683e+03  -1.446
## LivingstatusOther                                       6.658e+03  -0.444
## AnxietyYes                                              6.593e+03   0.579
## MoodDisordYes                                           6.558e+03   1.100
## Chronicconditions                                       6.630e+03  -2.100
## PASE_Total                                              6.563e+03  -1.035
## MAT_Normedbaseline                                      6.662e+03  46.108
## timefactor2:PandemicFU2 data collected before COVID-19  6.404e+03   3.396
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                             < 2e-16 ***
## PandemicFU2 data collected before COVID-19             2.42e-05 ***
## Age                                                    0.004693 ** 
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.718245    
## EducationLess than High School Diploma                 0.364045    
## EducationSome College                                  0.854364    
## EthnicityWhite                                         1.22e-05 ***
## IncomeLevel>$150k                                      0.498705    
## IncomeLevel$100-150k                                   0.338226    
## IncomeLevel$20-50k                                     0.108364    
## IncomeLevel$50-100k                                    0.175549    
## BMI                                                    0.055902 .  
## CESD.10baseline                                        0.008775 ** 
## SmokingStatusFormer Smoker                             0.952379    
## SmokingStatusNever Smoked                              0.567860    
## SmokingStatusOccasional Smoker                         0.546266    
## RelationshipstatusMarried                              0.970818    
## RelationshipstatusSeparated                            0.794072    
## RelationshipstatusSingle                               0.000839 ***
## RelationshipstatusWidowed                              0.249266    
## LivingstatusAssisted Living                            0.809692    
## LivingstatusHouse                                      0.148248    
## LivingstatusOther                                      0.657210    
## AnxietyYes                                             0.562654    
## MoodDisordYes                                          0.271302    
## Chronicconditions                                      0.035794 *  
## PASE_Total                                             0.300789    
## MAT_Normedbaseline                                      < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.000689 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.4.3.2) Estimated marginal means

lsmeans(modelMAT_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   10.88 0.225 Inf     10.43     11.32
##  FU2 data collected before COVID-19  10.51 0.229 Inf     10.06     10.96
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.51 0.225 Inf      9.07      9.95
##  FU2 data collected before COVID-19   9.51 0.229 Inf      9.06      9.96
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelMAT_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.36479 0.0864 Inf   4.224  <.0001
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##  -0.00436 0.0861 Inf  -0.051  0.9596
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelMAT_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.36479 0.0864 Inf     0.196     0.534
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##  -0.00436 0.0861 Inf    -0.173     0.164
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.4.3.3) Graph of estimated marginal means

MAT_lsmeans_adj10trun <- summary(lsmeans(modelMAT_adj10trun, ~Pandemic|timefactor))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
MAT_lsmeans_adj10trun$Time<-NA
MAT_lsmeans_adj10trun$Time[MAT_lsmeans_adj10trun$timefactor==1]<-"Follow-up 1"
MAT_lsmeans_adj10trun$Time[MAT_lsmeans_adj10trun$timefactor==2]<-"Follow-up 2"
ggplot(MAT_lsmeans_adj10trun, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "MAT Normalized Score", title = "Mental Alteration Test Normalized Score from FU1 to FU2 by Pandemic status 
       (controlling for baseline)") +
  theme_bw()

11.4.3.4) Planned contrasts

lsmeans.MAT10trun <- lsmeans(modelMAT_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12616' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12616)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.MAT10trun,list(c4th),by=NULL)
##  contrast                                     estimate    SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   -0.369 0.109 Inf  -3.396
##  p.value
##   0.0007
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.4.4) Animal Fluency

11.4.4.1) Model

modelAnimals_adj10trun<- lmer(Animal_Fluency_Normed ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + Animal_Fluency_Normedbaseline +
                           (1|ID), data= truncated.data_long_2)
summary(modelAnimals_adj10trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## Animal_Fluency_Normed ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + Animal_Fluency_Normedbaseline +  
##     (1 | ID)
##    Data: truncated.data_long_2
## 
## REML criterion at convergence: 60855.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8951 -0.5615 -0.0174  0.5379  4.2565 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.361    1.536   
##  Residual             3.190    1.786   
## Number of obs: 13639, groups:  ID, 6978
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             5.013e+00  3.358e-01
## timefactor2                                             9.184e-02  4.175e-02
## PandemicFU2 data collected before COVID-19              1.277e-01  5.799e-02
## Age                                                    -1.342e-02  3.101e-03
## SexM                                                   -1.421e-01  5.406e-02
## EducationHigh School Diploma                            1.751e-01  7.594e-02
## EducationLess than High School Diploma                  1.086e-01  1.076e-01
## EducationSome College                                   1.726e-01  9.413e-02
## EthnicityWhite                                          5.258e-01  1.507e-01
## IncomeLevel>$150k                                      -8.356e-02  1.388e-01
## IncomeLevel$100-150k                                   -2.957e-02  1.128e-01
## IncomeLevel$20-50k                                     -1.278e-01  7.593e-02
## IncomeLevel$50-100k                                    -2.310e-03  8.171e-02
## BMI                                                    -8.993e-03  5.119e-03
## CESD.10baseline                                        -1.085e-02  6.115e-03
## SmokingStatusFormer Smoker                              2.019e-01  1.034e-01
## SmokingStatusNever Smoked                               1.843e-01  1.075e-01
## SmokingStatusOccasional Smoker                          4.889e-02  2.038e-01
## RelationshipstatusMarried                               2.505e-02  8.898e-02
## RelationshipstatusSeparated                             2.000e-01  1.721e-01
## RelationshipstatusSingle                                7.335e-02  1.206e-01
## RelationshipstatusWidowed                              -7.619e-02  1.233e-01
## LivingstatusAssisted Living                            -1.263e-01  3.754e-01
## LivingstatusHouse                                       1.492e-01  8.113e-02
## LivingstatusOther                                      -2.717e-01  3.004e-01
## AnxietyYes                                              9.323e-02  1.062e-01
## MoodDisordYes                                           5.699e-02  7.666e-02
## Chronicconditions                                      -8.022e-03  1.251e-02
## PASE_Total                                              6.618e-04  3.594e-04
## Animal_Fluency_Normedbaseline                           5.208e-01  7.853e-03
## timefactor2:PandemicFU2 data collected before COVID-19  3.455e-02  6.171e-02
##                                                                df t value
## (Intercept)                                             6.952e+03  14.931
## timefactor2                                             6.849e+03   2.200
## PandemicFU2 data collected before COVID-19              1.145e+04   2.202
## Age                                                     6.899e+03  -4.329
## SexM                                                    6.906e+03  -2.629
## EducationHigh School Diploma                            6.918e+03   2.306
## EducationLess than High School Diploma                  6.991e+03   1.009
## EducationSome College                                   6.862e+03   1.834
## EthnicityWhite                                          6.856e+03   3.489
## IncomeLevel>$150k                                       6.915e+03  -0.602
## IncomeLevel$100-150k                                    6.884e+03  -0.262
## IncomeLevel$20-50k                                      6.909e+03  -1.684
## IncomeLevel$50-100k                                     6.909e+03  -0.028
## BMI                                                     6.889e+03  -1.757
## CESD.10baseline                                         6.924e+03  -1.774
## SmokingStatusFormer Smoker                              6.917e+03   1.953
## SmokingStatusNever Smoked                               6.916e+03   1.714
## SmokingStatusOccasional Smoker                          6.843e+03   0.240
## RelationshipstatusMarried                               6.942e+03   0.281
## RelationshipstatusSeparated                             6.966e+03   1.162
## RelationshipstatusSingle                                6.941e+03   0.608
## RelationshipstatusWidowed                               6.915e+03  -0.618
## LivingstatusAssisted Living                             6.968e+03  -0.337
## LivingstatusHouse                                       6.923e+03   1.839
## LivingstatusOther                                       6.785e+03  -0.904
## AnxietyYes                                              6.899e+03   0.878
## MoodDisordYes                                           6.916e+03   0.743
## Chronicconditions                                       6.885e+03  -0.641
## PASE_Total                                              6.897e+03   1.841
## Animal_Fluency_Normedbaseline                           6.893e+03  66.315
## timefactor2:PandemicFU2 data collected before COVID-19  6.787e+03   0.560
##                                                        Pr(>|t|)    
## (Intercept)                                             < 2e-16 ***
## timefactor2                                            0.027867 *  
## PandemicFU2 data collected before COVID-19             0.027696 *  
## Age                                                    1.52e-05 ***
## SexM                                                   0.008578 ** 
## EducationHigh School Diploma                           0.021129 *  
## EducationLess than High School Diploma                 0.312993    
## EducationSome College                                  0.066762 .  
## EthnicityWhite                                         0.000488 ***
## IncomeLevel>$150k                                      0.547131    
## IncomeLevel$100-150k                                   0.793217    
## IncomeLevel$20-50k                                     0.092297 .  
## IncomeLevel$50-100k                                    0.977449    
## BMI                                                    0.078991 .  
## CESD.10baseline                                        0.076036 .  
## SmokingStatusFormer Smoker                             0.050850 .  
## SmokingStatusNever Smoked                              0.086589 .  
## SmokingStatusOccasional Smoker                         0.810470    
## RelationshipstatusMarried                              0.778341    
## RelationshipstatusSeparated                            0.245295    
## RelationshipstatusSingle                               0.543007    
## RelationshipstatusWidowed                              0.536662    
## LivingstatusAssisted Living                            0.736431    
## LivingstatusHouse                                      0.065971 .  
## LivingstatusOther                                      0.365781    
## AnxietyYes                                             0.380075    
## MoodDisordYes                                          0.457293    
## Chronicconditions                                      0.521274    
## PASE_Total                                             0.065616 .  
## Animal_Fluency_Normedbaseline                           < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.575518    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.4.4.2) Estimated marginal means

lsmeans(modelAnimals_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.81 0.165 Inf      9.49      10.1
##  FU2 data collected before COVID-19   9.94 0.167 Inf      9.62      10.3
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19    9.91 0.165 Inf      9.58      10.2
##  FU2 data collected before COVID-19  10.07 0.167 Inf      9.74      10.4
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelAnimals_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.128 0.0580 Inf  -2.202  0.0277
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##    -0.162 0.0584 Inf  -2.777  0.0055
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelAnimals_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.128 0.0580 Inf    -0.241   -0.0140
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##    -0.162 0.0584 Inf    -0.277   -0.0477
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.4.4.3) Graph of estimated marginal means

Animals_lsmeans_adj10trun <- summary(lsmeans(modelAnimals_adj10trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
Animals_lsmeans_adj10trun$Time<-NA
Animals_lsmeans_adj10trun$Time[Animals_lsmeans_adj10trun$timefactor==1]<-"Follow-up 1"
Animals_lsmeans_adj10trun$Time[Animals_lsmeans_adj10trun$timefactor==2]<-"Follow-up 2"
ggplot(Animals_lsmeans_adj10trun, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  labs(x = "Time", y = "Animal Fluency Normalized Score", title = "Animal Fluency Normalized Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

11.4.3.4) Planned contrasts

lsmeans.Animals10trun <- lsmeans(modelAnimals_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 13639' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 13639)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Animals10trun,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))  -0.0346 0.0617 Inf  -0.560
##  p.value
##   0.5755
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic

11.4.5) Global cognition composite score

11.4.5.1) Model

modelGlobal_adj10trun<- lmer(Global_Composite ~ timefactor*Pandemic + Age + Sex + Education + Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus + Relationshipstatus + 
                            Livingstatus + Anxiety + MoodDisord + Chronicconditions + PASE_Total + Global_Compositebaseline +
                       (1|ID), data= truncated.data_long_2)
summary(modelGlobal_adj10trun)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Global_Composite ~ timefactor * Pandemic + Age + Sex + Education +  
##     Ethnicity + IncomeLevel + BMI + CESD.10baseline + SmokingStatus +  
##     Relationshipstatus + Livingstatus + Anxiety + MoodDisord +  
##     Chronicconditions + PASE_Total + Global_Compositebaseline +      (1 | ID)
##    Data: truncated.data_long_2
## 
## REML criterion at convergence: 57535.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3244 -0.5467 -0.0469  0.5038  3.6455 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  ID       (Intercept) 2.388    1.545   
##  Residual             4.077    2.019   
## Number of obs: 12383, groups:  ID, 6843
## 
## Fixed effects:
##                                                          Estimate Std. Error
## (Intercept)                                             1.579e+00  3.632e-01
## timefactor2                                            -8.329e-02  5.023e-02
## PandemicFU2 data collected before COVID-19              7.767e-03  6.577e-02
## Age                                                    -1.745e-02  3.438e-03
## SexM                                                   -6.374e-01  5.940e-02
## EducationHigh School Diploma                            2.057e-01  8.319e-02
## EducationLess than High School Diploma                  1.675e-01  1.207e-01
## EducationSome College                                   1.050e-01  1.027e-01
## EthnicityWhite                                          7.564e-01  1.667e-01
## IncomeLevel>$150k                                       1.997e-01  1.519e-01
## IncomeLevel$100-150k                                    1.504e-01  1.231e-01
## IncomeLevel$20-50k                                      1.768e-01  8.342e-02
## IncomeLevel$50-100k                                     3.047e-01  8.967e-02
## BMI                                                    -1.803e-02  5.585e-03
## CESD.10baseline                                        -1.877e-02  6.701e-03
## SmokingStatusFormer Smoker                              1.184e-01  1.128e-01
## SmokingStatusNever Smoked                               1.692e-01  1.174e-01
## SmokingStatusOccasional Smoker                          1.524e-01  2.224e-01
## RelationshipstatusMarried                               4.740e-02  9.761e-02
## RelationshipstatusSeparated                             5.822e-02  1.879e-01
## RelationshipstatusSingle                                2.558e-01  1.320e-01
## RelationshipstatusWidowed                              -1.985e-01  1.365e-01
## LivingstatusAssisted Living                            -7.067e-01  4.143e-01
## LivingstatusHouse                                      -1.618e-03  8.912e-02
## LivingstatusOther                                      -1.910e-01  3.340e-01
## AnxietyYes                                              1.043e-01  1.157e-01
## MoodDisordYes                                          -8.124e-03  8.342e-02
## Chronicconditions                                      -2.194e-02  1.375e-02
## PASE_Total                                              1.207e-03  3.924e-04
## Global_Compositebaseline                                5.451e-01  8.497e-03
## timefactor2:PandemicFU2 data collected before COVID-19 -1.288e-02  7.433e-02
##                                                                df t value
## (Intercept)                                             6.770e+03   4.348
## timefactor2                                             6.263e+03  -1.658
## PandemicFU2 data collected before COVID-19              1.131e+04   0.118
## Age                                                     6.776e+03  -5.074
## SexM                                                    6.695e+03 -10.732
## EducationHigh School Diploma                            6.679e+03   2.472
## EducationLess than High School Diploma                  6.975e+03   1.387
## EducationSome College                                   6.596e+03   1.023
## EthnicityWhite                                          6.758e+03   4.538
## IncomeLevel>$150k                                       6.641e+03   1.314
## IncomeLevel$100-150k                                    6.665e+03   1.221
## IncomeLevel$20-50k                                      6.734e+03   2.119
## IncomeLevel$50-100k                                     6.689e+03   3.398
## BMI                                                     6.608e+03  -3.229
## CESD.10baseline                                         6.689e+03  -2.801
## SmokingStatusFormer Smoker                              6.682e+03   1.050
## SmokingStatusNever Smoked                               6.682e+03   1.441
## SmokingStatusOccasional Smoker                          6.536e+03   0.685
## RelationshipstatusMarried                               6.723e+03   0.486
## RelationshipstatusSeparated                             6.780e+03   0.310
## RelationshipstatusSingle                                6.682e+03   1.938
## RelationshipstatusWidowed                               6.802e+03  -1.455
## LivingstatusAssisted Living                             6.431e+03  -1.706
## LivingstatusHouse                                       6.745e+03  -0.018
## LivingstatusOther                                       6.652e+03  -0.572
## AnxietyYes                                              6.666e+03   0.902
## MoodDisordYes                                           6.630e+03  -0.097
## Chronicconditions                                       6.698e+03  -1.596
## PASE_Total                                              6.649e+03   3.077
## Global_Compositebaseline                                6.690e+03  64.145
## timefactor2:PandemicFU2 data collected before COVID-19  6.220e+03  -0.173
##                                                        Pr(>|t|)    
## (Intercept)                                            1.40e-05 ***
## timefactor2                                            0.097326 .  
## PandemicFU2 data collected before COVID-19             0.906003    
## Age                                                    3.99e-07 ***
## SexM                                                    < 2e-16 ***
## EducationHigh School Diploma                           0.013459 *  
## EducationLess than High School Diploma                 0.165361    
## EducationSome College                                  0.306549    
## EthnicityWhite                                         5.78e-06 ***
## IncomeLevel>$150k                                      0.188812    
## IncomeLevel$100-150k                                   0.222045    
## IncomeLevel$20-50k                                     0.034125 *  
## IncomeLevel$50-100k                                    0.000683 ***
## BMI                                                    0.001249 ** 
## CESD.10baseline                                        0.005116 ** 
## SmokingStatusFormer Smoker                             0.293928    
## SmokingStatusNever Smoked                              0.149607    
## SmokingStatusOccasional Smoker                         0.493144    
## RelationshipstatusMarried                              0.627271    
## RelationshipstatusSeparated                            0.756609    
## RelationshipstatusSingle                               0.052664 .  
## RelationshipstatusWidowed                              0.145826    
## LivingstatusAssisted Living                            0.088078 .  
## LivingstatusHouse                                      0.985519    
## LivingstatusOther                                      0.567399    
## AnxietyYes                                             0.367239    
## MoodDisordYes                                          0.922417    
## Chronicconditions                                      0.110517    
## PASE_Total                                             0.002101 ** 
## Global_Compositebaseline                                < 2e-16 ***
## timefactor2:PandemicFU2 data collected before COVID-19 0.862388    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 31 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it

11.4.5.2) Estimated marginal means

lsmeans(modelGlobal_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.702 0.182 Inf     0.345     1.058
##  FU2 data collected before COVID-19  0.709 0.184 Inf     0.349     1.070
## 
## timefactor = 2:
##  Pandemic                           lsmean    SE  df asymp.LCL asymp.UCL
##  FU2 data collected after COVID-19   0.618 0.182 Inf     0.262     0.974
##  FU2 data collected before COVID-19  0.613 0.184 Inf     0.253     0.974
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95
contrast(lsmeans(modelGlobal_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none")
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##  -0.00777 0.0658 Inf  -0.118  0.9060
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df z.ratio p.value
##   0.00512 0.0655 Inf   0.078  0.9377
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic
confint(contrast(lsmeans(modelGlobal_adj10trun, ~Pandemic|timefactor), "pairwise", adj="none"), parm, level = 0.95)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## timefactor = 1:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##  -0.00777 0.0658 Inf    -0.137     0.121
## 
## timefactor = 2:
##  contrast                                                                  
##  (FU2 data collected after COVID-19) - (FU2 data collected before COVID-19)
##  estimate     SE  df asymp.LCL asymp.UCL
##   0.00512 0.0655 Inf    -0.123     0.134
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95

11.4.5.3) Graph of estimated marginal means

Global_lsmeans_adj10trun <- summary(lsmeans(modelGlobal_adj10trun, ~timefactor|Pandemic))
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
Global_lsmeans_adj10trun$Time<-NA
Global_lsmeans_adj10trun$Time[Global_lsmeans_adj10trun$timefactor==1]<-"Follow-up 1"
Global_lsmeans_adj10trun$Time[Global_lsmeans_adj10trun$timefactor==2]<-"Follow-up 2"
ggplot(Global_lsmeans_adj10trun, aes(x = Time, y = lsmean, fill = Pandemic)) +
  geom_bar(stat="identity", position=position_dodge()) +
  labs(x = "Time", y = "Global Cognitive Composite Score Score", title = "Global Cognitive Composite Score from FU1 to FU2 by Pandemic status
       (controlling for baseline)") +
  theme_bw()

11.4.5.4) Planned contrasts

lsmeans.Global10trun <- lsmeans(modelGlobal_adj10trun, ~Pandemic|timefactor)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 12383' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 12383)' or larger];
## but be warned that this may result in large computation time and memory use.
contrast(lsmeans.Global10trun,list(c4th),by=NULL)
##  contrast                                     estimate     SE  df z.ratio
##  structure(c(-1, 1, 1, -1), .Dim = c(4L, 1L))   0.0129 0.0743 Inf   0.173
##  p.value
##   0.8624
## 
## Results are averaged over the levels of: Sex, Education, Ethnicity, IncomeLevel, SmokingStatus, Relationshipstatus, Livingstatus, Anxiety, MoodDisord 
## Degrees-of-freedom method: asymptotic